[wp-trac] [WordPress Trac] #56035: Error logging improvements
WordPress Trac
noreply at wordpress.org
Tue Aug 2 05:46:10 UTC 2022
#56035: Error logging improvements
-------------------------+------------------------------
Reporter: galbaras | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Site Health | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by galbaras):
Thank you, @SergeyBiryukov .
According to the documentation:
> WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to
**also** be saved to a debug.log log file
This means it's not a way to override the logging destination, but to
write additional copies of the messages in another file.
Looking at `wp-includes/load.php`, this isn't the case. When
`WP_DEBUG_LOG` is set, it becomes the value of the PHP setting
`error_log`. However, it required `WP_DEBUG` to be true, which we normally
don't want/need.
On my sites, the `error_log` setting is set to "error_log", which means a
file with that name in the directory where the code is being executed.
This seems to be the source of having multiple files. Why not do this,
then:
{{{#!php
if ( ini_get( 'error_log' ) === 'error_log' ) {
ini_set( 'error_log', ABSPATH . 'error_log' );
}
}}}
The best place for this code is at the bottom of wp-config.php, after
`ABSPATH` is defined, or the top of wp-settings.php, ahead of anything
that can fail :)
Alternatively, provide a way to change the log file even then `WP_DEBUG`
is `false`.
> I could not find that string in core, it appears to come from the
iThemes Security plugin.
Embarrassingly, I knew that and opened a forum thread for this under
iThemes Security, which is now closed. I've opened a new one with the
updated message, which will hopefully be addresses by the respective team.
Having said that, a stack trace of this could really help, but we don't
have one :(
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56035#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list