-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
I have this set in my wp-config.php file:
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', '/tmp/debug_staging.log');
I have experienced that when I do error_log() through WP-CLI, the log goes to the standard log path of /wp-content/debug.log. This does not happen when errors are triggered by visiting pages and running functions from the browser.
Describe how other contributors can replicate this bug
- Register the following command for use through WP-CLI:
public function check_debug()
{
error_log(WP_DEBUG_LOG);
}
-
Define WP_DEBUG as true and set a specific path for WP_DEBUG_LOG in wp-config.php
-
Run check_debug() through WP-CLI
You will see your path from WP_DEBUG_LOG be logged in /wp-content/debug.log
Describe what you expect as the correct outcome
I expect the path of WP_DEBUG_LOG to be logged in the path set in WP_DEBUG_LOG.
Let us know what environment you are running this on
OS: Linux 5.4.72 #3 SMP Sun Oct 25 11:14:45 UTC 2020 x86_64
Shell: /bin/sh
PHP binary: /usr/app/php/7.4.22/bin/php
PHP version: 7.4.22
php.ini used: /etc/app/php/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: [REDACTED]
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0
Provide additional context
I have looked through the code here:
Line 43 in 0b22dee
| function wp_debug_mode() { |
If I paste the function wp_debug_mode() into check_debug() and then error_log $log_path on line 64, I get '/tmp/debug_staging.log' in the log file on the default location. I get nothing in /tmp/debug_staging.log.
I, therefore, do not know where this goes wrong and I have no idea how to fix it.