How to enable log debugging

Since version 3.1 of MailChimp for WordPress, the plugin comes with a debug log. This tool can be very helpful in debugging or monitoring background processes, without requiring your actual presence or actions.

The debug log

By default, the plugin will only log somewhat critical errors it encounters, but you can configure the plugin to send more helpful information to the log. There are 4 different log levels, listed here from low to high.

  • DEBUG: Detailed debug information
  • INFO: all interesting events. Example: "Form 10: johndoe@email.com subscribed" or "eCommerce360: order 100 added"
  • WARNING: Exceptional occurrences that are not errors. Example: "Email johndoe@email.com is already on the selected list."
  • ERROR: Runtime errors that do not require immediate action but should typically be logged and monitored. Example: errors returned by the MailChimp API.

By default, the plugin will only log events of the "error" type.

If you want to send all events to the debug log, you can do that by changing "debug log level" setting on the MailChimp for WP > Other page.

screenshot-from-2016-12-06-11-51-59

Alternatively, you can use the following filter hook.

add_filter( 'mc4wp_debug_log_level', function() { return 'debug'; } );

This will configure the plugin to log all events, from simple "interesting" events to "errors" which may or may not require your action.

Please note that we generally do not recommend permanently running the plugin on debug level on live websites.

Changing the location of the debug log file

By default, the plugin will create a log file in your uploads directory. If you want to change this, please use the `mc4wp_debug_log_file` filter.

add_filter( 'mc4wp_debug_log_file', function( $file ) {
   return '/var/log/mc4wp-debug.log';
});

Was this article helpful? ·