0
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('SAVEQUERIES', true);

these are lines from my wp-config.php file. What I expect now, that I can view a log file after I click around on my site. I don't find anything, especially no debug.log file in wp-contents. Is there anything else I have to do?

5
  • Check if there is a permission error to create a file in the wp-content directory for the server user. Commented Dec 31, 2017 at 13:26
  • no, there is not Commented Dec 31, 2017 at 13:31
  • 3
    If you expected to see the queries, SAVEQUERIES only "saves" them in the $wpdb object, you need to log them yourself, see example. Commented Dec 31, 2017 at 14:10
  • 1
    you can also see the queries with this plugin : wordpress.org/plugins/query-monitor Commented Dec 31, 2017 at 15:15
  • See also this SO answer for a solution: stackoverflow.com/a/4660903/1086134 Commented Apr 6, 2019 at 5:04

1 Answer 1

1

The debug log will only capture PHP-generated errors as well as things you manually send yourself. So if it is not being created right now, then there are no warnings/errors being generated by PHP right now.

In order to send things manually, you use error_log(). One quick note though is that you have to set echo to true if you use functions like print_r() to dump out arrays and such to see the actual contents, otherwise you'll just get a 1 so you'll want something like:

error_log( '--- $_POST ---' . PHP_EOL );
error_log( print_r( $_POST, true ) );
error_log( '--- End $_POST ---' . PHP_EOL );

This way you have some landmarks you can search for in the log. PHP_EOL is a constant that simply inserts \n for you so the log will have a line break.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.