As Debugging in WordPress explains, it’s easy to get good debugging information into a debug.log file while developing WordPress plugins and themes. Unfortunately, it sets the PHP error reporting level to
E_ALL, which includes
E_STRICT and can throw so much noise into the log that you can’t find the useful information. What we need is a way to turn on the debug log but specify the error reporting level.
It’s always a good idea to turn on
WP_DEBUG_LOG when testing, because it can give you all sorts of PHP warnings and highlight some simple bugs that might not otherwise become apparent to you until someone else tells you (in a bug report!)
But if you just want to find your error_log() messages without having to wade through all the warnings that other plugins and themes generate, drop this into a plugin and activate it when you need it. To save you time, you can download this gist, and save it into your plugins folder.
/** * turn on WP_DEBUG_LOG but without E_STRICT */ error_reporting(E_ALL ^ E_STRICT); ini_set('log_errors', 1); ini_set('display_errors', 0); ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
Now can get job done without eyes falling out reading endless logs of Strict warnings for other crappy plugins…