Log rotating with Monolog in Symfony2

后端 未结 2 1922
闹比i
闹比i 2021-02-05 04:10

I\'d like to know if there\'s any possibility to configure Monolog in Symfony2 to create a new log file every day, for example : 2013-11-21-prod.log.

2条回答
  •  生来不讨喜
    2021-02-05 04:39

    There is a logger called rotating_file.
    Here is a sample configuration:

    monolog:
        handlers:
            main:
                type:  rotating_file
                path:  %kernel.logs_dir%/%kernel.environment%.log
                level: debug
    

提交回复
热议问题