Debug logs can help track down production issues—as long as errors go to a file and not to the screen. This guide shows a safe approach and what to watch.
Safe approach
- Log errors to a file (e.g.
wp-content/debug.log) - Disable on-screen error display so users never see stack traces or paths
What to watch
- Log file growth and disk usage—rotate or trim as needed
- Sensitive data in logs (credentials, PII)—avoid logging those or restrict log access
FAQ
How do I enable debug logging without showing errors to users?
In wp-config.php: set WP_DEBUG to true, WP_DEBUG_LOG to true, and WP_DEBUG_DISPLAY to false. Optionally set WP_DEBUG_DISPLAY to false and use a plugin or custom code to avoid logging in production if you prefer.
Where do I look next when the log shows a fatal?
Correlate with Apache error logs and use WordPress 500 triage to confirm whether it’s plugin, theme, or server.
Related
- WordPress 500 errors: fast triage — 500 triage flow
- Apache log analysis for WordPress — server-side logs
- Fix a full root disk on Ubuntu WordPress servers — disk pressure from logs