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.
In information technology, log rotation is an automated process used in system administration in which log files are compressed, moved (archived), renamed or deleted once they are too old or too big (there can be other metrics that can apply here).
Each file should be rotated weekly. The log rotation job runs nightly, though, so this can be changed to daily for a specific log file if desired. The three commands that specify how often rotation should take place are daily, weekly and monthly. Keep four sets of log files.
In Monolog, there are a lot of formatters that can be used. You can find some built-in formatters here. You can also customize the format of the logs that are written in files, emails, databases, and other handlers. is the most common way to use a handler with a value to be directly put into the log device.
By default, log entries are written to the var/log/dev. log file when you're in the dev environment.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With