Repository navigation
feat!: log queue worker output through LoggerInterface instead of error_log() - #633
Merged
Merged
Conversation
Closed
4 tasks
…or_log() Worker and FailedJobHandler now take marko/log's LoggerInterface and log stop lines (info), the missing-pcntl warning (warning), and pop failures, timeouts and throwing failed() hooks (error) through it. Tests pass a FakeLogger and assert on its entries, so the worker suite no longer prints "Worker stopping" lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KaHtaJjfe2D38CdEdnmTb
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KaHtaJjfe2D38CdEdnmTb
markshust
force-pushed
the
feature/queue-worker-logger
branch
from
November 1, 2026 13:22
a82a054 to
0923bcd
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WorkerandFailedJobHandlernow log through marko/log'sLoggerInterfaceinstead of callingerror_log(). Noerror_log()calls are left inpackages/queue/src.info[marko/queue] Worker stopping: ...(once per run, including the timeout path inside the alarm handler)warningext-pcntlis not loadederrorfailed()hook threwTests pass a
FakeLoggerand assert on its entries, including the levels. Theini_set('error_log', ...)capture helpers inWorkerTest,WorkerLimitsTest,FailedJobHandlerTestandUniqueJobTestare gone, so the worker suite prints nothing extra.Decisions
marko/log, no queue-owned logging contract.marko/logis small (core, clock, config), ownsLoggerInterfaceand binds it itself, andFakeLoggeralready exists for tests. A second queue-only logging contract would duplicate it.[marko/queue]prefix. The log channel is app-wide (log.channel), so the prefix is what tells you which package a line came from. The message text is unchanged.Workertakes it after$clockand before the defaulted$processControl.FailedJobHandlertakes it last. A default would mean a silent fallback.INTEGRATION_MODULES,QUEUE_SESSION_MODULES) now linklog+log-file, and each fixture has aconfig/log.phpthat writes logs into its temporary project instead of the cwd.Breaking changes
marko/queueneed amarko/loghandler package. ResolvingWorker(andSyncQueue/DatabaseQueue, which useFailedJobHandler) resolvesLoggerInterface. Withmarko/loginstalled but no handler, that throwsNoDriverException, which names the packages to install. Upgrade:composer require marko/log-file, ormarko/log-streamwithLOG_HANDLERS=streamto keep worker lines on STDERR as before.new Worker($queue, $failedJobHandler, $config, $jobRunner, $retryPolicy, $clock, $logger)andnew FailedJobHandler($failedJobs, $envelope, $jobRunner, $eventDispatcher, $clock, $logger). Code that relies on the container needs no change.Both are covered in a new "Upgrading: worker logs go through
LoggerInterface" note on the queue docs page.Docs
queue.mdhas a new Worker Logs section: where logs go (log.handlers:storage/logswith log-file, STDERR/STDOUT with log-stream), the level of each line, and how to test withFakeLogger. The install section, the pop-failure, pcntl-warning, stop-reason andfailed()notes, theFailedJobHandlerAPI reference and the testing example were updated to match. The testing example was also missing the$clockargument, which is now added.Tests
composer cipasses locally (13680 passed, phpcs, php-cs-fixer, phpstan, docs:lint).integration-servicesgroup passes locally against Postgres and Redis fortests/Integration,queue-databaseandqueue-redis, includingqueue:workin both fixture apps.Fixes #608
🤖 Generated with Claude Code
https://claude.ai/code/session_017KaHtaJjfe2D38CdEdnmTb