Log rotating with Monolog in Symfony2

后端 未结 2 1926
闹比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:22

    On linux, you can use logrotate (I don't know if exists other solutions on windows or macos)

    In /etc/logrotate.d/ create a file (eg. sf2_myapp) and add this content :

    /path/to/your/symfony_app/app/logs/prod.log {
            daily
            missingok
            rotate 14
            compress
    }
    

    You should look for logrotate on Google for more infos

提交回复
热议问题