[英]Log rotating with Monolog in Symfony2
我想知道是否有可能在Symfony2中配置Monolog以每天创建一个新的日志文件,例如:2013-11-21-prod.log。
On linux, you can use logrotate (I don't know if exists other solutions on windows or macos) 在linux上,你可以使用logrotate(我不知道在windows或macos上是否存在其他解决方案)
In /etc/logrotate.d/ create a file (eg. sf2_myapp) and add this content : 在/etc/logrotate.d/中创建一个文件(例如sf2_myapp)并添加以下内容:
/path/to/your/symfony_app/app/logs/prod.log {
daily
missingok
rotate 14
compress
}
You should look for logrotate on Google for more infos 您应该在Google上查找logrotate以获取更多信息
There is a logger called rotating_file
. 有一个名为
rotating_file
的记录器。
Here is a sample configuration: 这是一个示例配置:
monolog:
handlers:
main:
type: rotating_file
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.