Where should I tell WordPress where error_log messages should be written?

On WP side the only handling it does is setting log to WP_CONTENT_DIR . '/debug.log' if WP_DEBUG_LOG is enabled (highly bad idea in production environment as public location). If I remember right the very early implementations of this constant allowed to customize the path, but that’s no longer the case.

In my experience ini_set( 'log_errors', 1 ); ini_set( 'error_log', '/path' ) in wp-config.php should be sufficient (if you don’t enable WP_DEBUG_LOG which will override it).

Your second case sounds strange. I would expect errors to go one destination or another, but not to two separate log files. It might be that something changes the configuration during runtime. It’s impossible to say without hands on troubleshooting.

Leave a Comment

tech