How to create error log in WordPress

Question

Hi,

How can I create an error log file in my WordPress installation?

Answer ( 1 )

    0
    2023-03-11T13:58:45+00:00

    Open your wp-config.php file.

    Find this line of code:

    define( 'WP_DEBUG', false );

    set it to

    define( 'WP_DEBUG', true );

    Then add this code below it:

    if ( WP_DEBUG ) {
       @error_reporting( E_ALL );
       @ini_set( 'log_errors', true );
       @ini_set( 'log_errors_max_len', '0' );
       define( 'WP_DEBUG_LOG', true );
       define( 'WP_DEBUG_DISPLAY', false );
       define( 'CONCATENATE_SCRIPTS', false );
       define( 'SAVEQUERIES', true );
    }

    This will create a debug.log file in your wp-content folder. Once you are done debugging, make sure to set the WP_DEBUG back to false.

Leave an answer