1

I've just changed to Laravel Herd earlier this week and needed to run Wordpress debugging on a theme I'm developing. This is where I noticed that Wordpress doesn't seem to be creating a/writing to debug.log-file when it's run through Herd.

I have the standard debug-definitions in my wp-config:

define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

I also have a write_log()-function, which should write to the same file, but nothing happens. This is the function:

if (!function_exists('write_log')) {
    function write_log($log) {
        if (true === WP_DEBUG) {
            if (is_array($log) || is_object($log)) {
                error_log(print_r($log, true));
            } else {
                error_log($log);
            }
        }
    }
}

This can be replicated with a clean Wordpress install by adding this to the wp-config.php

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Disable file editor
define('DISALLOW_FILE_EDIT', true);

error_log(print_r('hello', true));

The above snippet SHOULD write hello to the debug-file, but nothing happens.

Any tricks to activate Wordpress debugging on Laravel Herd?

Rvervuurt
  • 8,589
  • 8
  • 39
  • 62

0 Answers0