Search code examples
symfonyloggingsymfony4monolog

Symfony monolog fingers crossed handler not excluding specified http codes


I am using the fingers crossed handler to buffer log messages until an error occurs. Below is my config:

monolog:
  handlers:
    buffer:
      action_level: error
      excluded_http_codes: [401, 403, 404]
      handler: logger
      type: fingers_crossed
    logger:
      formatter: monolog.formatter.json
      include_stacktraces: true
      level: info
      path: php://stderr
      type: stream

I am finding that exceptions that should match the excluded_http_codes are still being output into my log.

I have dug into the Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy class and am finding that $this->requestStack->getMasterRequest() is returning null by the time the exception reaches the isHandlerActivated method.

Is there something I am clearly doing wrong?


Solution

  • This issue is resolved since updating my composer packages. I'm not sure which package was specifically responsible