如何配置monolog,将记录器保存在"每日日志"中。现在它根据环境保存。如何在路径中添加日期?
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
答案 0 :(得分:2)
正如in the doc所述,使用type: rotating_file
代替stream
,如果您不想用尽空间,请添加max_files
:
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