I have configured Symfony to use the rotating_file type of logging with Monolog, where I have configured it to write at the info level to a daily log file, eg. dev-2024-02-22.log. While this works, Symfony insists on writing tons of debug level logs to the generic dev.log file, and within minutes this log file fills up to over 4GB in size. I have configured my monolog.yaml like so:
monolog:
channels: ['database_activity']
handlers:
main:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
max_files: 10
formatter: monolog.formatter.json
channels: [ "!event", "!doctrine" ]
console:
type: console
process_psr_3_messages: false
level: info
channels: ["!event", "!doctrine", "!console", "!database_activity"]
How do I get Symfony to stop writing to dev.log altogether?
I found there is another setting in the generic monolog.yaml that is called "nested" and was using debug instead of info. I will see if removing this will ultimately prevent the dev.log from being written to.