With WP_DEBUG_LOG set to true, no debug output shows in debug.log, why? With WP_DEBUG_LOG set to true, no debug output shows in debug.log, why? wordpress wordpress

With WP_DEBUG_LOG set to true, no debug output shows in debug.log, why?


I encountered the same problem with WordPress running in Apache 2.4 on Fedora 19. Output of error_log() was landing in /var/log/httpd/error_log instead of wp-content/debug.log. Httpd process had write permission (+775) to /var/www/html/wp-content directory, but it was unable to create the wp-content/debug.log file.

My wp-config.php debug setting was:

@ini_set(‘display_errors’,0);define('WP_DEBUG',         true);define('WP_DEBUG_DISPLAY', false);define('WP_DEBUG_LOG', true);

As it turned out, the real cause was SELinux. I made SELinux policy change and allowed httpd to write to wp-content with following commands. (Refer SELinux Troubleshooter to get the actual command for your installation)

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/wp-content'restorecon -v '/var/www/html/wp-content'

After this debug messages start appearing in wp-content/debug.log.


the error_log() function writes to the web server's error log (e.g. /var/log/httpd/error_log); what you want is trigger_error().