4

This is more like of an inquiry.
So I enabled my WP_DEBUG_LOG to true.
It does work though, debug.log is in my wp-content's directory.
But does it also do log rotation like different file for each day?

Example:

Today's file - debug.log
Yesterday's - 2019-12-18-101010-debug.log

Does it work like this? Or just debug.log all through out?

2 Answers 2

11

No, it creates only one file. There is no log rotation involved.

But... Sometimes “but” can be a good thing ;)

WP uses error_log for its debug log, so you can change its location using:

ini_set( 'error_log', WP_CONTENT_DIR . '/debug-' . date('Y-m-d') . '.log' );
3
  • Oh I see. Thank you!!!!!!!
    – maryyyyyyy
    Commented Dec 19, 2019 at 8:06
  • Thank you, but where do you configure this ? ini_set( 'error_log', WP_CONTENT_DIR . '/debug-' . date('Y-m-d') . '.log' );
    – Hari
    Commented Nov 1, 2021 at 14:09
  • @Hari Generally, if you have access you would want to set this in your servers php.ini file. If you don't have access to edit this file you can try putting it into the root wp-config.php.
    – Howdy_McGee
    Commented Nov 1, 2021 at 14:29
1

An other way is set it in wp-config.php:

define( 'WP_DEBUG_LOG', (defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : __DIR__ . '/wp-content') . '/debug-' . date('Y-m-d') . '.log' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.