Skip to content

Combination of excluded_http_codes and passthru_level is not clearly documented #10896

Closed
@rpkamp

Description

@rpkamp

Symfony version(s) affected: 4.1+

Description
When configuring a fingers crossed logger in Monolog that has both excluded_http_codes as well as a passthrough_level that is =< ERROR the http exceptions will be logged anyway because they are flushed in \Monolog\Handler\FingersCrossedHandler::flushBuffer due to their level being >= ERROR.

How to reproduce
Put the following in config/packages/prod/monolog.yaml:

monolog:
  handlers:
    main:
      type: fingers_crossed
      action_level: error
      passthru_level: notice
      handler: nested
      excluded_http_codes: [404]

Expected result
HTTP 404 exceptions should not be logged

Actual result
HTTP 404 exceptions are logged

A warning should be added to the docs https://symfony.com/doc/current/logging/monolog_exclude_http_codes.html (and also https://symfony.com/doc/4.1/logging/monolog_regex_based_excludes.html) that the combination doesn't work.

I also created a bug report for this first (symfony/symfony#29904), but that was closed as this is not a problem with the code, but I still believe the documentation should be more clear to prevent people from chasing their own tail like I did.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions