【发布时间】:2021-10-22 14:13:00
【问题描述】:
我正在使用 Node 14.15.1、winston 3.3.3 和 winston-daily-rotate-file 4.5.5 在 Azure 应用服务上运行
我在文件旋转时随机发现以下错误。
不确定我做错了什么以及如何解决这个问题。任何建议都非常感谢。
提前致谢,
错误
2021-10-20T00:00:44.445079522Z events.js:292
2021-10-20T00:00:44.445119022Z throw er; // Unhandled 'error' event
2021-10-20T00:00:44.445125323Z ^
2021-10-20T00:00:44.445129523Z
2021-10-20T00:00:44.445134423Z Error: EIO: i/o error, close
2021-10-20T00:00:44.445137623Z Emitted 'error' event at:
2021-10-20T00:00:44.445140523Z at WriteStream.<anonymous> (/node_modules/file-stream-rotator/FileStreamRotator.js:677:15)
2021-10-20T00:00:44.445143723Z at WriteStream.emit (events.js:315:20)
2021-10-20T00:00:44.445146423Z at emitErrorNT (internal/streams/destroy.js:106:8)
2021-10-20T00:00:44.445149223Z at emitErrorCloseNT (internal/streams/destroy.js:74:3)
2021-10-20T00:00:44.445153323Z at processTicksAndRejections (internal/process/task_queues.js:80:21) {
2021-10-20T00:00:44.445157723Z errno: -5,
2021-10-20T00:00:44.445162223Z code: 'EIO',
2021-10-20T00:00:44.445166623Z syscall: 'close'
2021-10-20T00:00:44.445170323Z
日志记录代码
const logger = winston.createLogger({
format: winston.format.combine(
winston.format.splat(),
winston.format.timestamp(),
winston.format.printf(info => {
return `${tsFormat()} | ${info.level} | ${ info.message }`;
})
),
transports: [
new winston.transports.Console(),
new winston.transports.DailyRotateFile({
dirname: logDir,
filename: '%DATE%-KBK.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: true
})
]
});
【问题讨论】:
标签: node.js azure-web-app-service node-modules winston