From superpowers-sage
Guides structured logging in Acorn/WordPress using Laravel's Log facade: channels, levels, context arrays, stack traces, Slack notifications, and WP_DEBUG_LOG integration.
npx claudepluginhub codigodoleo/superpowers-sage --plugin superpowers-sageThis skill uses the workspace's default tool permissions.
Acorn uses Laravel's logging system inside WordPress. Logs are configured per-theme in `config/logging.php` and coexist with WordPress's native `debug.log`.
Creates artisan-style CLI commands with Acorn for WordPress automation, covering data imports, maintenance tasks, scheduled jobs, and theme operations via lando acorn.
Guides app logging implementation: log levels (error/warn/info/debug), structured logging, error tracking (Sentry/Datadog), avoiding noise.
Implements structured JSON logging with log levels (DEBUG/INFO/WARN/ERROR), contextual info, PII redaction, performance logging, and centralized logging. Use for observability, debugging, and production setup.
Share bugs, ideas, or general feedback.
Acorn uses Laravel's logging system inside WordPress. Logs are configured per-theme in config/logging.php and coexist with WordPress's native debug.log.
error_log() calls for local debugging — still valid for quick tracesWP_DEBUG_LOG = true) — native WordPress debug log is complementary, not redundantWP_DEBUG gatingconfig/logging.php published (step shown below)storage/logs/ writable by the web server useruse Illuminate\Support\Facades\Log;
// Basic usage
Log::info('Order placed successfully');
Log::warning('API rate limit approaching');
Log::error('Payment gateway timeout');
// Always pass context as an array — never interpolate strings
Log::error('Payment failed', [
'order_id' => $orderId,
'gateway' => $gateway,
'amount' => $amount,
]);
// Write to a specific channel
Log::channel('errorlog')->critical('Database connection lost');
// Write to multiple channels simultaneously
Log::stack(['daily', 'errorlog'])->error('Critical failure', ['trace' => $e->getMessage()]);
From most to least severe — use the appropriate level:
| Level | Use for |
|---|---|
emergency | System is unusable |
alert | Immediate action required |
critical | Critical conditions (component failure) |
error | Runtime errors that need attention |
warning | Unusual conditions, not errors |
notice | Normal but significant events |
info | General operational messages |
debug | Detailed debug info (dev only) |
See references/channels.md for channel config, custom channels, and WordPress debug.log bridge.
See references/structured-logging.md for context arrays, custom exceptions, and structured logging conventions.
See references/troubleshooting.md for logs not appearing, permission errors, daily rotation issues, Slack not notified.
Log::info('test', ['key' => 'value'])) and confirm it appears in the expected log file (e.g., storage/logs/acorn.log or the daily rotated variant).Log::channel('payments')->info('test')) and checking the channel-specific log file.storage/logs/ directory or the log file itself.lando ssh -s appserver -c "chmod -R 775 /app/content/themes/{theme}/storage/logs". Ensure the storage/ directory is writable by the web server user. In Lando, this is typically handled automatically but can break after manual file operations.Log::channel('name') does not exist in the channels array in config/logging.php.config/logging.php with the appropriate driver (single, daily, errorlog, etc.) and path. Verify config/logging.php exists in your theme directory.df -h and coordinate with the server administrator.config/logging.php or use the exception handler's reportable() method.