1
votes

Please, how to configure a custom path for Symfony logs using monolog?

My application logs is working fine, but I cant find the log for some errors, like this:

InvalidConfigurationException in VariableNode.php (I can't see this log on screen but I can't find on log files)

Actually, I'm using this config:

monolog:
    handlers:
        main:
            type:   stream
            path:   "%kernel.logs_dir%/app.log"
            level:  error

Thanks!

1

1 Answers

3
votes

Your config is only dealing with messages that are of log level ERROR or higher (this also includes CRITICAL, ALERT, and EMERGENCY). If you want to have logged everything into the app.log file, change the value of the minimum log level to be logged to that file to debug.

Alternatively, you can configure different handlers to have more verbose messages go to, for example, a debug.log file:

monolog:
    handlers:
        main:
            type:   stream
            path:   "%kernel.logs_dir%/app.log"
            level:  error
        rest:
            type:   stream
            path:   "%kernel.logs_dir%/debug.log"
            level:  debug