Wp-config.php, enable debug

Local is used for local development and testing, so please enable debug as a default:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

also, please add auth keys and salts to wp-config.php

1 Like

Salts will be in the next update :slight_smile:

Regarding WP_DEBUG, that will most likely be a toggle of some sort in a future version. Some themes/plugins still throw an absurd amount of notices and that can look bad for Local if people aren’t familiar with WP_DEBUG

1 Like

They shouldn’t use themes that throws a lot of warnings :wink:

3 Likes

If people only had WP_DEBUG on by default when they develop, we wouldn’t see that absurd amount of notices.

Hopefully, the toggle isn’t too far into the future.

I totally agree but not everyone using Local is actually developing themes/plugins.

+1 since the idea of local is ease of use :slight_smile:
Would suggest the wp-debug-log to be set to a file in the logs directory. There is a constant for that in WP

+1 for the log in the logs directory (btw, the path is set using ini_set( 'error_log', PATH . '/debug.log' ); )

… also, somebody might write an addon to display the debug.log in Local

@soderlind

Here’s an addon that Daniel Griffiths wrote for Local when it was still Pressmatic:

1 Like

@clay

Nice :slight_smile:

Do you have a list of known addons? Plan to write one, but no point in reinventing the wheel.

@soderlind

https://local.getflywheel.com/community/t/what-add-ons-are-available/338

1 Like

I misread the WP docs, the constant is WP_DEBUG_LOG and when true, this will set the debug log to wp-content/debug.log;

	if ( WP_DEBUG_LOG ) {
		ini_set( 'log_errors', 1 );
		ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
	}

in other words; you could set the error_log with ini_set, but WordPress will overrule this.
There does not seem to be a way to change this path :frowning:

I’ll keep looking :stuck_out_tongue:

1 Like

This would be really useful since we’re constantly deleting and creating sites for development. Perhaps automatically enable WP_DEBUG, WP_DEBUG_DISPLAY, WP_DEBUG_LOG when Dev Mode is On?

1 Like

Is a toggle for this still in the works?

Even nicer would be configurable defaults/a template for wp-debug.php

I have a plugin that might be useful. https://wordpress.org/plugins/wp-debugging

Nice!

Is there a way in Local to specify plugins to install and activate by default on new site spinup? (Is this what the Blueprint feature is/does?)

I think that’s essentially what the blueprint is for. I really don’t use it though. I actually have a framework that will optionally or not optionally install and activate plugins. It would be easy enough to make your own plugin that automatically installs whatever you want.

BTW, I use it in the WP Debugging plugin to ask about installing Query Monitor or Debug Bar.

DM me if you have questions.

1 Like

Cleaning up old feature requests and would love to see if we can get some movement on this!

I wanted to understand the nuance of this request so that we can move towards a good solution. First some observations:

  1. Local currently sets the WP_ENVIRONMENT_TYPE variable so that the wp_get_environment_type() function returns local

  2. Local currently doesn’t set any of the “debug” constants

  3. Local does have Xdebug enabled, along with pretty verbose error reporting turned on

That last item makes Local fairly noisy when warnings and fatal errors are encountered so I was curious what benefit setting the WP_DEBUG constant to true would give.

I know this is obvious to many, but it looks like the real benefit to enabling WP_DEBUG is that you make WordPress itself log more issues. This is significant since WordPress does such a good job of emphasizing backwards compatibility that often times it doesn’t break when a site is “doing it wrong.”

So for example, with WP_DEBUG set to false, using a deprecated function like get_postdata() will still work without any warnings, but setting WP_DEBUG to true will trigger a warning:

@ben.turner there are plugins such as WP Debugging that set these constants. There are other plugins such as Local Development, that will give the user the ability to change the environment variable. Unfortunately as Local sets this a PHP error results.

My only real recourse is to remove the line in local-bootstrap.php

1 Like

Thanks for sharing (and making) these awesome projects @afragen!

1 Like