Roots Discourse

Debug.log - wordpress debugging

i am used to using the debug.log file in the wp-content folder, this folder doesn’t exist in bedrock, i have tried putting the file in web/app which doesn’t work, does anyone know how i go about setting up wp debugging?

anyone? this seems like an issues that many people would come across

This isn’t an issue for me.

I opened up config/environments/development.php and added:

define('WP_DEBUG_LOG', true);

I then activated the WordPress Importer plugin which contains errors out of the box (lol). I immediately saw app/debug.log get created.

3 Likes

From the command line I added the WordPress Importer plugin
$ composer require "wpackagist-plugin/wordpress-importer:0.6.1"

Then activated it. WP Importer still contains bugs.

I can not find a debug.log file though.

Just a reminder that WP_DEBUG_LOG doesn’t work unless WP_DEBUG is also enabled.
(see Debugging in WP - Codex)

Set both of them to true in config/environments/development.php like this:

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

And then WP should log to
app/debug.log

https://codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG_LOG

2 Likes

HI everybody.
I have the following configuration in config/environments/development.php

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

But I still do not have a debug.log file created. When I call error_log in PHP, the error is logged into apache’s error log file (in /var/log/apache2/error.log) but do not see the debug.log file.

1 Like

Aside from the debug logs, you’ll find your error and access logs at your site’s root install. Eg: /srv/www/my-site.com/logs

The info provided in here and helped me debug many a quirk.

Have you reloaded your vagrant environment?

I don’t use Vagrant. I’m on Linux and I’m using the LAMP stack. There is no need to reload Apache or PHP or something else to take new PHP constant definition into account, but yeah I tried to restart everything and it does not work.

If you triggered an error and still don’t have a app/debug.log file, then make sure that your webserver is able to actually write to that directory/file

PS: this then displays “define(‘WP_DEBUG_LOG’, true);” on the homepage as is