Closed james-allan closed 2 months ago
In WC 8.6, WC core change the logger to have new features
I've also tested on 8.5.2 (WC old logger) and these changes work consistant with how it worked in the past. ie additional context is logged as separate entries.
I also wanted to highlight that as part of these changes I've also improved the main error message that is logged.
Previously we would just log this:
...failed to finish processing due to the following exception: This is a fatal error
We now log the file and line information
... failed to finish processing due to the following exception: This is a fatal error in /public/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php:63
In this case, its not particularly helpful because it points to AS as that's where the exception was created. For exceptions its more accurate. I'm going to file an issue on AS to see if they could use ErrorException
instead.
Description
In WC 8.6, WC core change the logger to have new features that enable you to store additional context about an error and for that to be viewable in the log file itself.
This PR updates our
WCS_Failed_Scheduled_Action_Manager
to make use of those features. As part of this update I've also updated what is logged to better assist with narrowing down the cause of these issues.How to test this PR
Setup
wp_actionscheduler_actions
tablewoocommerce_scheduled_subscription_payment
actionTimeouts
pending
and refresh any admin page.in-progress
in the database.failed-scheduled-actions
log in WooComemrce > Status > LogsErrors
failed-scheduled-actions
file if you want to keep things tidy.$error_type = 'error'
line.pending
and refresh any admin page.in-progress
in the database.failed-scheduled-actions
log in WooComemrce > Status > LogsUncaught Exceptions
failed-scheduled-actions
file if you want to keep things tidy.$error_type = 'exception'
line.pending
and refresh any admin page.in-progress
in the database.failed-scheduled-actions
log in WooComemrce > Status > LogsFatal errors
ActionScheduler_Abstract_QueueRunner::process_action()
).failed-scheduled-actions
file if you want to keep things tidy.$error_type = 'fatal'
line.pending
and refresh any admin page.in-progress
in the database.failed-scheduled-actions
log in WooComemrce > Status > LogsProduct impact