Skip to content

Commit 8667d62

Browse files
authored
Log failed Action Scheduler actions (#60)
Add logging for failed Action Scheduler executions.
1 parent 6e52602 commit 8667d62

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

mu-plugins/woocommerce.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,18 @@ static function () {
222222
10,
223223
0
224224
);
225+
226+
// Log failed AS actions
227+
add_action(
228+
'action_scheduler_failed_execution',
229+
static function ($action_id, $e, $context) {
230+
error_log(sprintf(
231+
'[AS FAILED] action_id=%d context=%s error=%s',
232+
$action_id,
233+
(string) $context,
234+
$e instanceof \Exception ? $e->getMessage() : 'unknown'
235+
));
236+
},
237+
10,
238+
3
239+
);

0 commit comments

Comments
 (0)