[wp-trac] [WordPress Trac] #56035: Error logging improvements

WordPress Trac noreply at wordpress.org
Wed Jun 22 08:22:23 UTC 2022


#56035: Error logging improvements
--------------------------+-----------------------------
 Reporter:  galbaras      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Site Health   |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The current error logging isn't always as helpful as it could be. Here are
 some things that can be improved:

 1. Consolidation of all messages to one log file. I sometimes see the same
 message in error_log and wp-admin/error_log. Sometimes, I see admin
 messages only in error_log, and it's often a hassle cross-referencing
 issues that may occur on the front-end, but are an effect of some admin
 issue.

 When factoring in things like WooCommerce logs and other special cases, it
 gets even worse.

 Therefore, I suggest having one file where all messages are written,
 whether they are written somewhere else as well or not.

 Since `error_log()` is a PHP function, this can be done via a wrapper
 function and/or communication with plugin and theme developers, unless
 someone has a better idea.

 2. All database query failures should be logged along with the context in
 which they occurred (the call stack).

 3. Site Health recovery messages should be written to the log file, not
 just sent by email.

 When changing code, it's important to fix errors quickly, and email can
 take a few minutes to arrive in some cases, e.g. when the email goes via
 some external spam filtering service.

 4. Ideally, the default log file should be named `error.log` or
 `error_log.txt` to make it easier to open it on computers that associate
 text editors with file name extensions.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56035>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list