如何在白天拆分Dancer错误日志?

Ail*_*sFX 3 perl logging dancer

我想在我的网站上使用舞者和明星.我成功地将错误日志设置到文件中.当然我可以运行脚本来每天移动错误日志.但我只是想知道是退出方法还是cpan模块来解决问题.谢谢〜

mat*_*ull 8

不要重新发明轮子,你将重复已经修复过去的错误.

使用logrotate.它是一种unix工具,专门用于此类任务.

要旋转日志,通常会为您的任务创建一个logrotate配置/etc/logrotate.d/.

例如,每天旋转并保留您的日志14天:

# /etc/logrotate.d/dancer-error-log

/path/to/my/dancer-error.log {
    daily
    rotate 14
    create 0660 mydanceruser mydancergroup
}
Run Code Online (Sandbox Code Playgroud)