-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Description
Every time I restart the node server I get: New log file created
, but the logs work as expected.
Every time I restart the system, the logs get overwritten. Every one of them.
I have set up maxFiles: '14d', and all 14 files get overwritten.
Basically, this package doesn't work as intended.
Unfortunately I have not seen any activity on this repo and I start to believe that this will never get fixed and that I have to look for an alternative.
There is a similar 2 years old issue: #367
I am using this config:
const dailyRotateTransport = new winston.transports.DailyRotateFile({
dirname: PATHS.LOGS,
filename: 'backend-%DATE%.log',
datePattern: 'yyyy-MM-DD',
zippedArchive: true,
maxSize: '20m',
maxFiles: '14d',
createSymlink: true,
symlinkName: 'current.log',
auditFile: path.join(PATHS.LOGS, 'rotate-audit.json'),
options: {
mode: 0o660,
flags: 'a'
}
});
dailyRotateTransport.on('new', (filename) => {
console.log(`New log file created: ${filename}`);
});
dailyRotateTransport.on('rotate', (oldFilename, newFilename) => {
console.log(`Log rotated from ${oldFilename} to ${newFilename}`);
});
dailyRotateTransport.on('error', (error) => {
console.error('DailyRotateFile Error:', error);
});
const logTransports: winston.transport[] = [dailyRotateTransport];
export const logger = winston.createLogger({
levels: logLevels,
level: process.env.NODE_ENV === 'production' ? 'update' : 'debug',
transports: logTransports,
exitOnError: false
});
djedu28
Metadata
Metadata
Assignees
Labels
No labels