'How to exclude deprecation messages from logs in Symfony 4?

I have migrated an application from Symfony 3.4 to Symfony 4.4.

Now I have a lot of deprecations for each request/ Sf command (I can't fix that deprecations).

How can I exclude deprecations from the log for this Symfony App?



Solution 1:[1]

Exclude the php channel from the log handler:

Eg. config/packages/prod/monolog.yaml:

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
            formatter: monolog.formatter.session_request
            channels:
             -  '!php' # <----------- add this line

Leave deprecation messages in the dev mode though. You should be aware of the changes in upstream packages.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1