如何使用 bunyan 实现日志轮换

问题描述

我正在为文件使用以下配置

const auditLogFile = config.log.location + '/audit.log';
const errorLogFile = config.log.location + '/error.log';

const logTypes = {
    audit: {
        stream: new RotatingFileStream({
            path: auditLogFile,period: '1d',// daily rotation
            totalFiles: 2,// keep up to 5 back copies
            rotateExisting: true,// Give ourselves a clean file when we start up,based on period
            threshold: '50k',// Rotate log files larger than 10 megabytes
            totalSize: '100k',// Don't keep more than 20mb of archived log files
            gzip: true,// Compress the archive log files to save space
        }),level: bunyan.INFO,},error: {
        stream: new RotatingFileStream({
            path: errorLogFile,level: bunyan.ERROR,}
};

但是,文件大小将超过 50kb,并且不会旋转。我错过了什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...