Troubleshooting
Logger package issues and fixes.
File Issues
Log file not created
Problem: File handler doesn't create log file.
Cause: Directory doesn't exist or permissions.
Fix: Ensure log directory exists:
$logDir = $context->path('logs');
if (!is_dir($logDir)) {
wp_mkdir_p($logDir);
}
$handler = new FileHandler($logDir . '/app.log');
Permission denied
Problem: Can't write to log file.
Cause: File/directory permissions.
Fix: Check permissions:
chmod 755 logs/
chmod 644 logs/app.log
Handler Issues
Logs not appearing in error_log
Problem: Using ErrorLogHandler but nothing in error_log.
Cause: PHP error_log disabled or wrong path.
Fix: Check PHP config:
error_log(ini_get('error_log')); // Check path