Skip to content

excluded_http_codes might not work properly #271

Closed
@Sengorius

Description

@Sengorius
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.1

I'm currently using monolog to get informed about errors from a multi-user-site. For my current setup I used https://symfony.com/blog/new-in-symfony-4-1-ignore-specific-http-codes-from-logs as resource.

As you can see below, I tried to exclude 403 and 404 errors (especially) from mailing handler. As for all 404 it might work, but I'm still receiving mails on any 403 error.

# config/packages/prod/monolog.yaml
monolog:
    handlers:
        main:
            type: fingers_crossed
            action_level: error
            handler: grouped
            excluded_http_codes: [403, 404]

        grouped:
            type: group
            members: [nested, mailer]

        nested:
            type: rotating_file
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug
            max_files: 30

        mailer:
            type: deduplication
            handler: swift_mail

        swift_mail:
            type: swift_mailer
            from_email: '%env(MAILER_DEFAULT_MAIL)%'
            to_email: '%env(MAILER_SERVICE_MAIL)%'
            subject: 'Exception in M-OBS: %%message%%'
            level: debug
            formatter: monolog.formatter.html
            content_type: text/html
            excluded_http_codes: [403, 404]

        console:
            type: console
            process_psr_3_messages: false
            channels: ["!event", "!doctrine"]

Can you please fix this or is it my error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions