WooCommerce Ignores Logging Level, Creates Debug Logs for Every Order
Summary:
A bug in WooCommerce causes it to generate place-order-debug-* log files for every order placed, even when the global logging level is set to 'Critical'. This occurs because the internal function wc_log_order_step writes debug-level logs that do not respect the configured logging threshold.
The issue leads to an excessive number of log files being created, with stores experiencing 20-30 orders per day accumulating hundreds of files within a short period. This unnecessarily consumes server disk space and clutters the logs directory, making it difficult to find genuine error logs.
Standard WooCommerce filters, such as woocommerce_logger_levels and woocommerce_logger_should_handle, are ineffective at preventing these logs, indicating the logging mechanism for order steps bypasses the usual log level checks.
How to Replicate:
- Navigate to WooCommerce → Status → Logging → Settings.
- Set the logging level to 'Critical'.
- Place a test order on the store.
- Check the
wp-content/uploads/wc-logs/directory. - Observe that a new
place-order-debug-*log file has been created despite the Critical log level.