I have multiple production shops with a Symfony base. Now i want to write a log file which logs all deprecations.
I want them to appear in a "deprecated.log" file. These deprecations are read into kibana later.
The Monolog-Readme says
WARNING (300): Exceptional occurrences that are not errors. Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
(https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md)
So I tried this config
monolog:
use_microseconds: false
handlers:
main:
type: group
members: [errors, deprecations]
errors:
type: error_log
level: ERROR
deprecations:
type: stream
level: WARNING
path: '%kernel.logs_dir%/deprecated.log'
channels: [php]
But the deprecated.log
was not generated.
What is my mistake? Error-Log seems to work, but not my deprecations.
Was looking around everywhere, this solution was very nice. But even nicer is that since 5.1 there is deprecations channel
monolog:
channels: [deprecation]
handlers:
deprecation:
type: stream
channels: [deprecation]
path: php://stderr //or file path like '%kernel.logs_dir%/deprecated.log'