Debugging – logging database queries

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.