symfony / monolog-bundle

Symfony Monolog Bundle
symfony.com
MIT License
2.89k stars 231 forks source link

fingers_crossed logs everything when a warning is logged #450

Closed wouter-vs closed 1 year ago

wouter-vs commented 1 year ago

I use the 'fingers_crossed' type in combination with the 'error' as level but still all the logs are dumped the moment a warning is added.

$this->logger->warning("Message")

I would only expect this to happen when an error is set. when I remove the line it works perfect, there are also a number of info messages logged but they don't show up in the logs anymore.

I have the following configuration in my project:

        adsolut:
            type: fingers_crossed
            level: error
            handler: adsolut_file_log
            channels: ['adsolut']
            buffer_size: 50
        adsolut_file_log:
            type: rotating_file
            path: "%kernel.logs_dir%/adsolut-%kernel.environment%.log"
            max_files: 10

Am I doing something wrong?

HypeMC commented 1 year ago

You need to use action_level, not level:

        adsolut:
            type: fingers_crossed
-           level: error
+           action_level: error
            handler: adsolut_file_log
            channels: ['adsolut']
            buffer_size: 50