Queuety
Features

Logging

Queuety logs every job and workflow event to the queuety_logs database table. There are no log files. All entries are queryable via the PHP API and CLI.

Event types

Every log entry has an event type from the LogEvent enum:

EventDescription
startedJob execution started
completedJob completed successfully
failedJob threw an exception
buriedJob exhausted all retry attempts
retriedJob was scheduled for retry
workflow_startedWorkflow was dispatched
workflow_completedAll workflow steps finished
workflow_failedWorkflow step failed permanently
workflow_pausedWorkflow was paused
workflow_resumedWorkflow was resumed
debugDebug-level message (when QUEUETY_DEBUG is enabled)

Log fields

Each log entry contains:

FieldDescription
idAuto-increment ID
eventEvent type string
handlerHandler name or class
job_idAssociated job ID (nullable)
workflow_idAssociated workflow ID (nullable)
step_indexWorkflow step index (nullable)
attemptAttempt number
duration_msExecution duration in milliseconds
error_messageError message if failed
created_atTimestamp

Querying logs via PHP

$logger = Queuety::logger();

// Logs for a specific job
$logs = $logger->for_job( 42 );

// Logs for a specific workflow
$logs = $logger->for_workflow( 7 );

// Logs for a specific handler
$logs = $logger->for_handler( 'send_email', 50 );

// Logs for a specific event type
$logs = $logger->for_event( \Queuety\Enums\LogEvent::Failed, 50 );

// Logs since a datetime
$logs = $logger->since( new \DateTimeImmutable( '-1 hour' ), 100 );

Querying logs via CLI

# Recent logs (last 24 hours)
wp queuety log

# Logs for a specific job
wp queuety log --job=42

# Logs for a specific workflow
wp queuety log --workflow=7

# Logs for a handler
wp queuety log --handler=send_email

# Logs for an event type
wp queuety log --event=failed

# Logs since a datetime
wp queuety log --since="2025-01-01 00:00:00"

# Custom limit and format
wp queuety log --limit=100 --format=json

Log retention

By default, logs are kept forever. To auto-purge old entries, set QUEUETY_LOG_RETENTION_DAYS:

define( 'QUEUETY_LOG_RETENTION_DAYS', 30 ); // purge logs older than 30 days

Purge manually via CLI:

wp queuety log purge --older-than=30

Or via PHP:

$count = Queuety::logger()->purge( 30 );

On this page