node.js - Winston Logger (v2.4) 即使在旋转后也写入文件
问题描述
我有一个用于控制台输出的传输器以及一个用于文件输出的传输器。这工作正常并创建一个新的日志文件,同时重命名旧的,例如。日志/appLogs.txt 和日志/appLogs1.txt
我面临的问题是它继续写入第一个文件,即使它高于最大大小。Winston 正在记录到这两个文件,但在两者之间拆分日志。
例如:appLogs1.txt
2019-02-21T18:53:04.581Z - debug: ... logs
和 appLogs.txt
2019-02-21T18:53:04.538Z - debug: ... logs
我可以 ssh 进入容器并ls -l
看到两个文件都在增长。
下面是我的温斯顿配置:
new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
timestamp: true,
handleExceptions: true,
stderrLevels: ['error'],
humanReadableUnhandledException: true,
level: level,
label: category
}),
new winston.transports.File({
filename: 'logs/appLogs.txt',
maxsize: 5000000,
maxFiles: 20,
tailable : true,
timestamp: true,
handleExceptions: true,
humanReadableUnhandledException: true,
level: level,
label: category,
json: false
})
]
})
appLogs1.txt 现在是 9948153 字节,appLogs.txt 是 882922
解决方案
推荐阅读
- java - 为什么Java中ResultSet的索引以'1'而不是零开头?
- android - 如何将 HSL 颜色转换为 RGB、Hex 等其他颜色?
- algorithm - Scheme中的扩展欧几里得算法
- php - 从 Woocommerce 中的单个产品中删除 27 中的侧边栏
- f# - 根据之前的类型选择生成 F# 类型
- pandas - pandas to_latex() 转义“\\newline”以在 LaTex 中使用
- python - python中摆的泰勒级数
- php - PHP中的连续切换
- urllib - Python facebook 聊天簿从谷歌下载
- perl - perl 中带有前缀 0 数字的错误