pierzcha
pierzcha

Reputation: 11

Symfony 3.4 Daily logger

How can I config monolog, to save my logger in "daily logs". Now it saves according to the environment. How can I add date to path?

monolog:
handlers:
    main:
        type:   stream
        path:   "%kernel.logs_dir%/%kernel.environment%.log"

Upvotes: 0

Views: 995

Answers (1)

Veve
Veve

Reputation: 6758

As explained in the doc, use type: rotating_file instead of stream, and add a max_files if you don't want to run out of space:

monolog:
handlers:
    main:
        type:   rotating_file
        path:   "%kernel.logs_dir%/%kernel.environment%.log"
        # max number of log files to keep
        # defaults to zero, which means infinite files
        max_files: 10

Upvotes: 2

Related Questions