From superpowers-sage
Logging in Acorn/WordPress with structured log levels, custom channels (daily, Slack, syslog), Monolog handlers, and WordPress debug.log integration. Includes Lando tail-log commands.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-sage:acorn-loggingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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`.
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.npx claudepluginhub hekivo/superpowers-sageCreates and runs custom artisan-style CLI commands for WordPress using Acorn. Useful for scheduled imports, maintenance scripts, and automation tasks within Sage themes.
Guides on using walkerOS logger patterns in sources/destinations: when to log, DRY principles, migration from console.log, and available methods (error, warn, info, debug, json, scope).
Guides log level selection, structured logging, and error tracking integration. Use when implementing logging in application code to keep error tracking actionable.