-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WP_DEBUG_LOG
#499
Add WP_DEBUG_LOG
#499
Conversation
Maybe we should set a good default one in the development config? Is |
I believe so. Updated default to |
config/application.php
Outdated
@@ -106,6 +106,7 @@ | |||
* Debugging Settings | |||
*/ | |||
Config::define('WP_DEBUG_DISPLAY', false); | |||
Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? $webroot_dir . Config::get('CONTENT_DIR') . '/uploads/debug.log'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WP_CONTENT_DIR . '/uploads/debug.log'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config::apply
is not yet applied at this point.
WP_CONTENT_DIR
is most likely undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with Config::get('WP_CONTENT_DIR')
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? "${WP_CONTENT_DIR}/uploads/debug.log");
Config::apply();
==> PHP Notice: Undefined variable: WP_CONTENT_DIR in ......./config/application.php on line 129
echo WP_DEBUG_LOG;
==> /uploads/debug.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid setting a default here? This could cause unintended consequences on high-availability setups. In the case WP_DEBUG is set to true on purpose or on accident this is a fail-open behavior rather than fail-safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we I recommend avoiding setting a default here. This could cause unintended consequences on high-availability setups. In the case WP_DEBUG is set to true on purpose or on accident this is a fail-open behavior rather than fail-safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we settle for:
Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? false);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that LGTM. fail-safe default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, what do we do on development?
When using valet, it seems difficult to get the valet logs directory path.
When using trellis, roots/trellis#1160 handles it.
I think my brain has bugs. I kept missing details in the PR comments.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In development the developer just does whatever works best for their development setup.
config/application.php
Outdated
@@ -106,6 +106,7 @@ | |||
* Debugging Settings | |||
*/ | |||
Config::define('WP_DEBUG_DISPLAY', false); | |||
Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? $webroot_dir . Config::get('CONTENT_DIR') . '/uploads/debug.log'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid setting a default here? This could cause unintended consequences on high-availability setups. In the case WP_DEBUG is set to true on purpose or on accident this is a fail-open behavior rather than fail-safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both. |
@@ -13,6 +13,7 @@ DB_PASSWORD='database_password' | |||
WP_ENV='development' | |||
WP_HOME='http://example.com' | |||
WP_SITEURL="${WP_HOME}/wp" | |||
WP_DEBUG_LOG=/path/to/debug.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value should be true
imo so that it goes with default WordPress behavior.
See: roots/trellis#1160