How To Keep Log Of WordPress PHP And Database Errors ?

Keeping Error Logs is helpful to know about invalid database queries and file requests of your website. You can easily enable error logging in WordPress either by plugin or by hack. 

Error Log Hack

Open your site’s wp-config.php (present in your site’s root directory) and addd the following code replacing  /path/to/error.log to actual path of your log file:

define(‘WP_DEBUG’, true);
if (WP_DEBUG) {
define(‘WP_DEBUG_DISPLAY’, false);
@ini_set(‘log_errors’, ‘On’);
@ini_set(‘display_errors’, ‘Off’);
@ini_set(‘error_log’, ‘/path/to/error.log’);
}

Error Log Plugin

Error Log Monitor is a good plugin to do so. It adds a Dashboard widget that displays the latest messages from your PHP error log. Also sends logged errors to email address. Know more about its features:

  • Automatically detects location of error log.
  • Describes how to configure PHP error logging.
  • Number of displayed log entries is configurable.
  • Sends email notifications for logged errors. This is optional.
  • Configurable email address and frequency.
  • Easily clearance of log file.
  • Widget is only visible to admins.
  • Works well even with very large log files.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.