Logger Stores
Action Scheduler logging is handled by the ActionScheduler_Logger abstraction and two concrete implementations:
ActionScheduler_DBLogger(custom tables)ActionScheduler_wpCommentLogger(legacy WP comments)
This document covers all public methods, filters, and persistence details for both loggers.
Logger Abstraction (ActionScheduler_Logger)
Located in classes/abstracts/ActionScheduler_Logger.php.
Instance Selection
ActionScheduler_Logger::instance() uses:
- Default class:
ActionScheduler_wpCommentLogger - Filter:
action_scheduler_logger_class
$class = apply_filters( 'action_scheduler_logger_class', 'ActionScheduler_wpCommentLogger' );
Abstract Methods
log( $action_id, $message, ?DateTime $date = null )get_entry( $entry_id )get_logs( $action_id )
Public Methods (Shared Behavior)
init() attaches logging to core execution hooks:
action_scheduler_canceled_action→log_canceled_action()action_scheduler_begin_execute→log_started_action()action_scheduler_after_execute→log_completed_action()action_scheduler_failed_execution→log_failed_action()action_scheduler_failed_action→log_timed_out_action()action_scheduler_unexpected_shutdown→log_unexpected_shutdown()action_scheduler_reset_action→log_reset_action()action_scheduler_execution_ignored→log_ignored_action()action_scheduler_failed_fetch_action→log_failed_fetch_action()action_scheduler_failed_to_schedule_next_instance→log_failed_schedule_next_instance()action_scheduler_bulk_cancel_actions→bulk_log_cancel_actions()
Other public methods:
hook_stored_action()/unhook_stored_action()- Attach/detach logging for
action_scheduler_stored_action.
- Attach/detach logging for
log_stored_action( $action_id )log_canceled_action( $action_id )log_started_action( $action_id, $context = '' )log_completed_action( $action_id, $action = null, $context = '' )log_failed_action( $action_id, Exception $exception, $context = '' )log_timed_out_action( $action_id, $timeout )log_unexpected_shutdown( $action_id, $error )log_reset_action( $action_id )log_ignored_action( $action_id, $context = '' )log_failed_fetch_action( $action_id, ?Exception $exception = null )log_failed_schedule_next_instance( $action_id, Exception $exception )bulk_log_cancel_actions( $action_ids )(default per-action fallback)
ActionScheduler_DBLogger (Custom Tables)
Located in classes/data-stores/ActionScheduler_DBLogger.php.
Storage Model
Logs are stored in the custom table actionscheduler_logs (registered via ActionScheduler_LoggerSchema).
Columns used:
log_id(primary key)action_idmessagelog_date_gmtlog_date_local
Public Methods
log( $action_id, $message, ?DateTime $date = null )
Inserts a log row into actionscheduler_logs with GMT and local timestamps.
get_entry( $entry_id )
Fetches a single log row and returns an ActionScheduler_LogEntry (or ActionScheduler_NullLogEntry if missing).
get_logs( $action_id )
Returns all log entries for an action.
init()
Initializes tables via ActionScheduler_LoggerSchema, calls parent init(), and hooks:
action_scheduler_deleted_action→clear_deleted_action_logs()
clear_deleted_action_logs( $action_id )
Deletes log rows for a deleted action.
bulk_log_cancel_actions( $action_ids )
Bulk inserts “action canceled” entries for a list of action IDs.
ActionScheduler_wpCommentLogger (WP Comments)
Located in classes/data-stores/ActionScheduler_wpCommentLogger.php.
Storage Model
Logs are stored as WordPress comments:
comment_post_ID= action IDcomment_type=action_logcomment_author/comment_agent=ActionSchedulercomment_content= messagecomment_date/comment_date_gmt= log timestamp
Public Methods
log( $action_id, $message, ?DateTime $date = null )
Creates a comment via wp_insert_comment().
get_entry( $entry_id )
Returns a single ActionScheduler_LogEntry from a comment, or ActionScheduler_NullLogEntry for non-log comments.
get_logs( $action_id )
Loads all comment logs for an action via get_comments() and returns log entries in ascending date order.
filter_comment_queries( WP_Comment_Query $query )
Adds a filter to exclude Action Scheduler log comments from general comment queries.
filter_comment_query_clauses( $clauses, $query )
Adds a SQL WHERE clause to exclude comment_type = action_log.
filter_comment_feed( $where, WP_Query $query )
Excludes log comments from comment feeds.
filter_comment_count( $stats, $post_id )
Removes log comments from comment counts (and for global counts, removes order notes too).
delete_comment_count_cache()
Clears the cached comment counts when comments change.
init()
Hooks:
action_scheduler_before_process_queue→disable_comment_counting()action_scheduler_after_process_queue→enable_comment_counting()pre_get_comments→filter_comment_queries()wp_count_comments→filter_comment_count()comment_feed_where→filter_comment_feed()wp_insert_comment/wp_set_comment_status→delete_comment_count_cache()
disable_comment_counting() / enable_comment_counting()
Toggle comment count deferral to improve performance.
Filters and Actions
Filters
action_scheduler_logger_class— select logger implementation
Actions Consumed by Logger
action_scheduler_stored_actionaction_scheduler_canceled_actionaction_scheduler_begin_executeaction_scheduler_after_executeaction_scheduler_failed_executionaction_scheduler_failed_actionaction_scheduler_unexpected_shutdownaction_scheduler_reset_actionaction_scheduler_execution_ignoredaction_scheduler_failed_fetch_actionaction_scheduler_failed_to_schedule_next_instanceaction_scheduler_bulk_cancel_actions