Skip to content

Queue: inject a logger into Worker instead of calling error_log() #608

Closed

Description

@markshust

Problem

Marko\Queue\Worker reports stop reasons, timeouts and failures with error_log(). Since #551 (PR #602) added a shared "Worker stopping" line, about 100 worker tests print that line to the test output under PHPUnit 12, which captures error_log() per test. The tests still pass, but the noise hides real output. Apps also can't send worker logs anywhere other than PHP's error log.

Proposal

Inject Marko's LoggerInterface (marko/log) into Worker and the alarm-handler path, and log through it. marko/log binds LoggerInterface itself since #555, so no extra driver choice is needed. Tests pass a FakeLogger (from marko/testing) and assert on the stop line rather than printing it. If marko/queue shouldn't hard-require marko/log, define a tiny queue-owned logging contract instead and say why in the PR.

Exit criteria

  • No error_log() calls left in packages/queue/src
  • The worker test suite prints nothing extra; stop lines are asserted through FakeLogger
  • Docs: queue page says where worker logs go
  • composer ci green

Follow-up from #551.

Activity

  1. markshust commented on Nov 1, 2026

    @markshust
    CollaboratorAuthor

    Fixed in #633 (merged). The queue Worker and FailedJobHandler now log through LoggerInterface, and marko/queue requires marko/log. There are no error_log() calls left. Tests assert through FakeLogger, so the worker suite no longer prints stop lines. Breaking: apps need a log handler package. The skeleton will ship marko/log-file and marko/log-stream (#640), with LOG_HANDLERS=file as the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttestingTest additions or improvements

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions