Skip to content

Instantly share code, notes, and snippets.

@fgilio
Forked from jdevalk/logging-helper.php
Last active September 20, 2015 05:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgilio/76d631ce0fa19ed7891e to your computer and use it in GitHub Desktop.
Save fgilio/76d631ce0fa19ed7891e to your computer and use it in GitHub Desktop.
This little hack enables fatal error logging for your site, without creating an error log that is insanely big.
<?php
/**
* This changes logging to only log fatal errors. This file should go in your mu-plugins directory.
*/
// Set the error logging to only log fatal errors
error_reporting( E_ERROR );
// Optional: change the location of your error log, it might be wise to put it outside your WP content dir.
// If you don't change it, the default place for this log is debug.log in your WP_CONTENT_DIR.
ini_set( 'error_log', WP_CONTENT_DIR . '/fatal-error.log' );
// Disable Akismets awfully verbose logging
add_filter( 'akismet_debug_log', '__return_false' );
<?php
/**
* These three lines should go in your wp-config.php
*/
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment