Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fodger opened this issue Aug 31, 2023 · 3 comments
Labels

Comments

@fodger
Copy link

fodger commented Aug 31, 2023

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

@fodger fodger changed the title No log generated at all when using excluded_http_codes with group handler. No log generated at all when using excluded_http_codes with group handler including two handlers or more. Aug 31, 2023
@fodger fodger changed the title No log generated at all when using excluded_http_codes with group handler including two handlers or more. No log generated when using excluded_http_codes with group handler including two handlers or more. Aug 31, 2023
@fodger fodger changed the title No log generated when using excluded_http_codes with group handler including two handlers or more. No log generated when using excluded_http_codes with group handler including two handlers or more (symfony/monolog-bundle 3.x). Aug 31, 2023
@OskarStark OskarStark added the Bug label Aug 31, 2023
@fodger fodger changed the title No log generated when using excluded_http_codes with group handler including two handlers or more (symfony/monolog-bundle 3.x). No log generated when using excluded_http_codes with some sub handlers (symfony/monolog-bundle 3.x). Aug 31, 2023
@fodger fodger changed the title No log generated when using excluded_http_codes with some sub handlers (symfony/monolog-bundle 3.x). No log generated when using excluded_http_codes with some sub handlers under group (symfony/monolog-bundle 3.x). Aug 31, 2023
@stof
Copy link
Member

stof commented Oct 24, 2023

what do you mean by "it stops generation of logs" ? Do you mean that 404 responses are not logged anymore ? that's kind of expected if you exclude them in the activation strategy of the fingers_crossed (and there is no other error activating the fingers_crossed in that request)

@fodger
Copy link
Author

fodger commented Oct 31, 2023

I mean all errors codes are excluded with fingers_crossed. Please try !!!

@fodger
Copy link
Author

fodger commented Dec 5, 2023

Any definitive answer please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants