Skip to content

No log generated when using excluded_http_codes with some sub handlers under group (symfony/monolog-bundle 3.x). #462

@fodger

Description

@fodger

This configuration for monolog stops generation of logs in var/log/ when adding excluded_http_codes: [404].
When we disable it, it works.


monolog:
  handlers:
    main:
      type:  fingers_crossed
      path:  '%kernel.logs_dir%/%kernel.environment%.log'
      level: warning
      excluded_http_codes: [404]
      channels: ['!event']
      handler: grouped
    grouped:
      type:    group
      members: [streamed, deduplicated]
    streamed:
      type:  rotating_file
      path:  '%kernel.logs_dir%/%kernel.environment%.log'
      level: warning
      max_files: 5
    deduplicated:
      type:    deduplication
      handler: symfony_mailer
    symfony_mailer:
      type:       symfony_mailer
      from_email: '%env(MAILER_MONOLOG_ADDRESS)%'
      to_email:   '%env(MAILER_MONOLOG_ADDRESS)%'
      subject:    '[%kernel.environment%-ERROR] %%message%%'
      level:      warning
      formatter:  monolog.formatter.html
      content_type: text/html
    console:
      type: console

Using a simpler configuration, its works properly such as :

monolog:
  handlers:
    main:
      type:  fingers_crossed
      path:  '%kernel.logs_dir%/%kernel.environment%.log'
      level: warning
      channels: ['!event']
      handler: grouped
      excluded_http_codes: [404]
    grouped:
      type:    group
      members: [streamed]
    streamed:
      type:  rotating_file
      path:  '%kernel.logs_dir%/%kernel.environment%.log'
      level: warning
      max_files: 5

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