Open Livia-Peng opened 1 year ago
this.logStream.on('logRemoved', function (params) {
if (options.zippedArchive) {
var gzName = params.name + '.gz';
if (fs.existsSync(gzName)) {
try {
fs.unlinkSync(gzName);
}
catch (_err) {
// file is there but we got an error when trying to delete,
// so permissions problem or concurrency issue and another
// process already deleted it we could detect the concurrency
// issue by checking err.type === ENOENT or EACCESS for
// permissions ... but then?
}
self.emit('logRemoved', gzName);
return;
}
}
self.emit('logRemoved', params.name);
});
It seems not easy to reproduce it. But for now, disabling the archiving is simpler.
We're using the Winston daily logger like so:
However, it's not deleting old zipped log files. I tested that not zipped files can be deleted.