Search code examples
phpsymfonymonolog

Log rotating with Monolog in Symfony2


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.


Solution

  • 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