#18391 closed enhancement (fixed)
Expand WP_DEBUG_LOG and make WP_DEBUG_DISPLAY work as expected
Reported by: | nacin | Owned by: | pento |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bootstrap/Load | Keywords: | has-patch has-dev-note |
Focuses: | Cc: |
Description
WP_DEBUG_LOG
WP_DEBUG_LOG currently creates wp-content/error.log. We should expand this to allow a path.
To do this, if WP_DEBUG_LOG is !== true, != 1, != 'true', (anything else?) and 0 === validate_file(), we should treat it as a path.
WP_DEBUG_DISPLAY
Setting WP_DEBUG_DISPLAY to false does not set display_errors to false. Instead, it prevents display_errors from being set to on. This forces a call to ini_set to turn off display_errors, assuming your php.ini is set to On, as expected for a development environment configuration.
Instead, setting WP_DEBUG_DISPLAY to false should set display_errors to false. I've been thinking about this for months now, and the only situation I can come up with that this would be a compatibility issue would be when you deliberately have a production php.ini on production and a development php.ini in development. In this situation, WP_DEBUG_DISPLAY = false would screw up your development environment only -- the only breakage would be showing less errors, rather than more.
WP_DEBUG_DISPLAY === null can remain a passthrough.
Patch forthcoming.
Attachments (4)
Change History (27)
#3
in reply to:
↑ 2
@
13 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Replying to edwardw:
The patch has only been partially applied so far. We need to decide whether or not the second part will applied before closing.
#4
@
13 years ago
We need to decide whether or not the second part will applied before closing.
Second part is WP_DEBUG_LOG?
#5
@
13 years ago
- Milestone changed from 3.3 to Future Release
Punting the WP_DEBUG_LOG path support. Feels like something isn't quite right about the patch.
#7
@
9 years ago
- Keywords needs-patch added
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from reopened to closed
Closing as wontfix on the WP_DEBUG_LOG path support part. Complete lack of interest on the feature on the ticket over the last 4 years. Feel free to reopen when more interest re-emerges (particularly if there's a patch)
#9
@
9 years ago
- Keywords has-patch added; needs-patch removed
- Resolution wontfix deleted
- Status changed from closed to reopened
#13
@
7 years ago
Refreshed the patch as I'm in a situation where WordPress runs in a read-only environment, and I'd like to enforce WP_DEBUG_DISPLAY
as false
while also ensuring logs can be gathered via WP_DEBUG_LOG
to a temporary directory.
#14
@
7 years ago
Came here with similar dilemma and found a patch already in this ticket. Using WP_DEBUG_LOG as string path to a custom location is best solution IMO. +1 for this to be available during next release as it would make development lot smoother. My development case is based on using WP docker image.
#15
@
7 years ago
- Milestone changed from Awaiting Review to 5.0
- Owner set to SergeyBiryukov
- Status changed from reopened to reviewing
#16
@
7 years ago
- Keywords commit added
validate_file()
cannot be used here, as wp_debug_mode()
is called before wp-includes/functions.php
is included. We could duplicate its checks here, but I wonder how useful they are in this context. If someone has access to define WP_DEBUG_LOG
, they could as well set error_log
directly.
is_writeable()
check cannot be used either, as it requires the file to exist, but it may not be created yet.
18391.3.diff is my take on the patch.
#17
@
7 years ago
IMHO, I don't see much of a point in checking if a developer's given file location exists or not. If developer is capable enough to specify a custom file location then file_write error should easily be understandable in case of a wrong file location. My take would be one of followings as already given in some of above patches:
WP_DEBUG_LOG = true
WP_DEBUG_LOG = 1
WP_DEBUG_LOG = /tmp/wordpress.log
My case is using docker image of WP where I can simple define this as part of the environment variables which would save me the hassle of sneaking in a line with "ini_set" to otherwise enable a custom location for logs. Example docker-compose:
... services: wordpress: image: wordpress:latest environment: - WP_DEBUG=1 - WP_DEBUG_LOG=/tmp/wordpress.log ...
PS could someone please post a link to the guidance on how to contribute to WP?
#18
follow-up:
↓ 19
@
6 years ago
I agree with @jabranr, PHP's native file system errors seem perfectly fine to me in the case of a bad path.
Here's that link btw:
#19
in reply to:
↑ 18
@
6 years ago
Replying to acobster:
Thank you!
I agree with @jabranr, PHP's native file system errors seem perfectly fine to me in the case of a bad path.
Here's that link btw:
#21
@
6 years ago
- Owner changed from SergeyBiryukov to pento
- Status changed from reviewing to accepted
#23
@
6 years ago
- Keywords has-dev-note added; commit removed
This was detailed in a dev note: https://make.wordpress.org/core/2019/01/23/miscellaneous-developer-focused-changes-in-5-1/
In [18545]: