Make WordPress Core

Opened 13 years ago

Closed 10 years ago

#16107 closed defect (bug) (wontfix)

WordPress Database Error Logging Extravaganza

Reported by: hakre's profile hakre Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.4
Component: Database Keywords:
Focuses: Cc:

Description

If PHP error logging is enabled, the wordpress database class will log errors to file by using the error_log() function. This is a PHP function.

While doing so, it does not reflect the PHP configuration setting for log_errors_max_len which defaults to 1024 (bytes).

While not doing so, the database class can log extremely long queries into the file creating multiple gigabytes quite quickly.

Attachments (2)

16107.patch (683 bytes) - added by hakre 13 years ago.
Patch for single site installations.
16107-db-complete.patch (1.2 KB) - added by hakre 13 years ago.
patch for both installation types

Download all attachments as: .zip

Change History (8)

#1 @hakre
13 years ago

  • Keywords has-patch added
  • Version changed from 3.1 to 3.0.4

@hakre
13 years ago

Patch for single site installations.

@hakre
13 years ago

patch for both installation types

#2 @hakre
13 years ago

FYI: I had a single error reporting line that was 21.7 MB, the whole file about 2.4 GB within less than a week. It's basically because of a large option value, which seems valid to me by database definition as those are LONGTEXT (L + 4 bytes, where L < 232) so somewhat up to 4 GB is available for each option value if I'm correct (WP limits this to 256MB in the admin).

Last edited 13 years ago by hakre (previous) (diff)

#3 follow-up: @westi
13 years ago

  • Milestone changed from Awaiting Review to Future Release

I'm not sure we should even call error_log for these really IMHO.

I think it is probably better to have a hook for a plugin to do this if it really wants to.

#4 in reply to: ↑ 3 @hakre
13 years ago

Replying to westi:

I'm not sure we should even call error_log for these really IMHO.

I think it is probably better to have a hook for a plugin to do this if it really wants to.

error_log can be configured by php settings, you can find more in the php manual. So it's already plugable. But for the somehow akward integration you should use blame and ask the developer who wrote that, I can not tell you.

But on what you comment is not really within the scope of my report. Please open a new ticket if you really have those questions.

Last edited 13 years ago by hakre (previous) (diff)

#5 @chriscct7
10 years ago

  • Keywords dev-feedback added

I'd rather have 10gb of error messages than none at all. Since logging them is turned on using a constant (WP_DEBUG_LOG added in #10202), I feel that the concern about the size of a log file, particularly now that allotted disk size on hosts are much larger than 5 years ago, that it would be better to continue logging as much information as possible about an error than cutting off the error message.

Thoughts?

#6 @pento
10 years ago

  • Keywords has-patch dev-feedback removed
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Agreed, this is an expected side effect of WP_DEBUG. Log files can grow pretty quickly when logging debug info.

Note: See TracTickets for help on using tickets.