Skip to content

Enable WooCommerce Debug Logging

WooCommerce provides instructions to enable WooCommerce Debug Logging. However, on VIP the WC Logger must be configured to write to the WC_Log_Handler_DB handler to prevent debug logs from writing to the /tmp files directory. This WC Logger handler should be defined in the vip-config.php file as seen in this example:

vip-config/vip-config.php
define( 'WC_LOG_HANDLER', 'WC_Log_Handler_DB' );

By default, the WC Logger will retain logs for 30 days. Lowering the number of days that logs are retained is recommended, and the woocommerce_logger_days_to_retain_logs filter should be used to set a lower value. 

It is also recommended to disable WooCommerce debug logging once the needed configuration and debugging for a project is complete. This will reduce unnecessary load on the primary database.

Last updated: December 26, 2023

Relevant to

  • WordPress