Search code examples
phpsymfonymonolog

Symfony do not log deprecations


i want the log to behave like the regular php-log in production. There is a logrotate in place and the server-logs are analyzed with other tools.

So i set up my config_prod.yml like that:

monolog:
use_microseconds: false
handlers:
    main:
        type: error_log
        level: WARNING
    deduplicated:
        type: deduplication
        time: 60
        handler: main

Somehow the deprecations (via @trigger_error) appear in my log, too.

Can i disable the logging of the deprecations somehow? I don't need them in prod but only in dev.

Kind regards. Patrick


Solution

  • You can try to exclude a channel php from your handler

    use_microseconds: false
    handlers:
      main:
        type: error_log
        level: WARNING
      deduplicated:
        type: deduplication
        time: 60
        handler: main
        channels: ['!php']