Pretty logs in WooCommerce

One of the changes in WooCommerce 2.7 is an improved log system. Along with that came an option to change from text files to database logging. It lets us view, filter and sort logs right from the admin area. It comes with a shiny new interface on the WooCommerce admin status page.

WooCommerce will register a handler by default which can be configured by the constant WC_LOG_HANDLER, so you can add this to your wp-config.php to use the DB logger:

define( 'WC_LOG_HANDLER', 'WC_Log_Handler_DB' );

This constant should be the name of a log handler class. It determines the default handler as well as the viewer on the WooCommerce admin status page, so I recommend you use one of the core handlers.

Leave a Reply

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