Could not remove old log file
See original GitHub issueconst winston = require('winston');
require('winston-daily-rotate-file');
const transport = new (winston.transports.DailyRotateFile)({
"name": "basic-log",
"datePattern": "YYYY-MM-DD",
"zippedArchive": false,
"level": "info",
"colorize": false,
"filename": "./logs/log-%DATE%.txt",
"maxSize": "1m",
"maxFiles": "10",
});
transport.on('rotate', function(oldFilename, newFilename) {
// do something fun
console.log(new Date(), oldFilename, newFilename)
});
const logger = new (winston.Logger)({
transports: [
transport
]
});
const str = 'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World!';
setInterval(function () {
for (let i = 0; i < 100; i++)
logger.info(str);
}, 10);
2018-03-20T12:44:14.690Z ‘logs\log-2018-03-20.txt.4’ ‘logs\log-2018-03-20.txt.5’ 2018-03-20T12:44:15.368Z ‘logs\log-2018-03-20.txt.5’ ‘logs\log-2018-03-20.txt.6’ 2018-03-20T12:44:16.067Z ‘logs\log-2018-03-20.txt.6’ ‘logs\log-2018-03-20.txt.7’ 2018-03-20T12:44:16.751Z ‘logs\log-2018-03-20.txt.7’ ‘logs\log-2018-03-20.txt.8’ 2018-03-20T12:44:17.468Z ‘logs\log-2018-03-20.txt.8’ ‘logs\log-2018-03-20.txt.9’ 2018-03-20T12:44:18.190Z ‘logs\log-2018-03-20.txt.9’ ‘logs\log-2018-03-20.txt.10’ 2018-03-20T12:44:18.869Z ‘logs\log-2018-03-20.txt.10’ ‘logs\log-2018-03-20.txt.11’ 2018-03-20T12:44:19.590Z ‘logs\log-2018-03-20.txt.11’ ‘logs\log-2018-03-20.txt.12’ 2018-03-20T12:44:20.270Z ‘logs\log-2018-03-20.txt.12’ ‘logs\log-2018-03-20.txt.13’ 2018-03-20T12:44:20.968Z ‘logs\log-2018-03-20.txt.13’ ‘logs\log-2018-03-20.txt.14’ 2018-03-20T12:44:20.968Z '[FileStreamRotator] Could not remove old log file: ’ ‘logs\log-2018-03-20.txt.4’ 2018-03-20T12:44:21.689Z ‘logs\log-2018-03-20.txt.14’ ‘logs\log-2018-03-20.txt.15’ 2018-03-20T12:44:22.369Z ‘logs\log-2018-03-20.txt.15’ ‘logs\log-2018-03-20.txt.16’ 2018-03-20T12:44:23.069Z ‘logs\log-2018-03-20.txt.16’ ‘logs\log-2018-03-20.txt.17’ 2018-03-20T12:44:23.790Z ‘logs\log-2018-03-20.txt.17’ ‘logs\log-2018-03-20.txt.18’ 2018-03-20T12:44:24.469Z ‘logs\log-2018-03-20.txt.18’ ‘logs\log-2018-03-20.txt.19’ 2018-03-20T12:44:25.170Z ‘logs\log-2018-03-20.txt.19’ ‘logs\log-2018-03-20.txt.20’ 2018-03-20T12:44:25.870Z ‘logs\log-2018-03-20.txt.20’ ‘logs\log-2018-03-20.txt.21’ 2018-03-20T12:44:26.570Z '[FileStreamRotator] Could not remove old log file: ’ ‘logs\log-2018-03-20.txt.12’ 2018-03-20T12:44:26.570Z ‘logs\log-2018-03-20.txt.21’ ‘logs\log-2018-03-20.txt.22’ 2018-03-20T12:44:27.282Z ‘logs\log-2018-03-20.txt.22’ ‘logs\log-2018-03-20.txt.23’
and with “zippedArchive”: true no file is deleted
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:30 (8 by maintainers)
Top GitHub Comments
Same here, “maxFiles”: “1d” doesn’t work in my end.
@mattberther Do we have any updates on this?