WP_DEBUG_LOG stopped working

I configured my Local site to log errors to a file instead of displaying them on the web page. I have these rules in my wp-config.php:

define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );

It had been working as expected, logging errors to debug.log, then for some reason it stopped logging errors to debug.log. I did recently update to latest version of Local by Flywheel. It can’t be related to that can it?

Well, if anyone has any ideas of what could cause error logging to stop, even though the debug rules were not changed, I would appreciate the help. Thanks!

Hey @clayteller,

What Environment and Environment Version is the site running? Also, did you update the site’s Environment?

Another thing that may help is going to Help » Restart Local’s Machine to ensure that all of the folders are mounted correctly.

Hi @clay, thanks for offering some help. I restarted Local but still not logging to debug.log file for me after the restart. I’m attaching screenshot of version info for my site. Please let me know if there was something else you were asking for.

Regarding updating the site environment, I do see the prompt in the Local admin window to “update environment” but had stopped short of doing it because the message suggesting I “clone changes to a local site” before updated made me nervous about proceeding. You recommend updating though?

On my other Local site, which uses “Preferred” environment, debug is working as expected.58%20AM

@clayteller If you install Query Monitor and check the Environment settings are they showing as you expect?

Is it possible that some other plugin is setting WP_DEBUG_LOG to false?

Not that you need it but I’ve written a plugin WP Debugging that will set these parameters in your wp-config.php on activation and remove them on deactivation. It also will install Query Monitor and Debug Quick Look. Someone may find it useful. :wink:

1 Like

@afragen thanks for your suggestion. That’s funny, I just installed Query Monitor yesterday to investigate some page loading slowness. Everything looks right to me in the Environment summary. I’ll attach screenshot.

@clayteller it all looks correct. I wonder if it’s a permissions issue for the wp-content folder.

@afragen yeah worth a look… I view permissions of wp-content directory in terminal and it is the same permissions as the wp-content directory in my other site which doesn’t have any issues. Screenshot from my terminal window:

Does the debug.log file exist and what are its permissions?

Hey @clayteller

Along the lines of @clay 's question about Environment type and version – What if you export this site, and then import it as a new site?

Does the imported site do this logging correctly?

– Ben

@afragen in my past experience debug.log will be created by WordPress when it does not exist. I’ve tried both scenarios: without the file and with debug.log file with “777” permissions, and neither one worked for me

@ben.turner I just did the following with no luck: 1) clone the site in question 2) load the new cloned site, which was automatically updated to the latest environment 1.3.1 in the course of cloning 3) load pages on the cloned site to see if errors will be logged to debug.log and they were not

Very odd. Not sure I have any other ideas. Your sure there are errors and you’re simply not writing perfect code? :wink:

1 Like

Something about this feels like a file/folder mounts type of thing. I know it sounds odd, but have you restarted the computer since the update?

Also, is there any information in the Local log, or one of the files in the logs folder for the site?

– Ben

@afragen thanks anyways. If only :grin:

@ben.turner I tried restarting but the issue remains. So, I decided to update the environment for my site (whereas earlier I cloned and updated the clone). Also, there was a new version of Local available, so I updated to the latest version of Local as well. I was hopeful that the updated environment and updated Local software would lead to a fix. Not only did it not resolve the debug file issue, now my pages are taking around 3 times longer to load. I just don’t get it…really frustrating. Honestly, this is why I was reluctant to update in the first place. I do appreciate the help, it just sucks I’m worse off now. I guess I’ll try to change back to the previous environment now. Not really sure where to go from here.

@ben.turner I’m not sure where to check for the Local log, but am interested to find it and take a look. Can you tell me where to look for that? Only errror log I see in logs folder is in nginx folder.error.log (6.3 KB)

Ok, now pages are loading like they were before. Haven’t changed anything since my last report, so not sure why they were taking so long to load a while ago. Anyways, hopefully the triple page load time is a non-issue now.

See “How do I retrieve Local's log file? - FAQ - Local Community” for where to look.

Basically, on a Mac it’s located at ~/Library/Logs/local-by-flywheel.log

One thing while looking at that NGINX error.log log – I see a few references to urls that might not be correct, for example:

  • https://ere.ere.dev

– Ben