winstonjs / winston-daily-rotate-file

A transport for winston which logs to a rotating file each day.
MIT License
899 stars 156 forks source link

Log rotation is not happening with daily time frame. #319

Open nkshweta opened 3 years ago

nkshweta commented 3 years ago

Hello team,

I'm trying to use log rotation for daily basis where file is with same name but different timestamp but the file is not getting created when i use frequency 1d.

My transport file goes like this: const debug = new DailyRotateFile({ frequency:'1d', // log file should be rotated every 1 day. dirname: logDir, // where the log file should be saved. utc: true, // date in log file name should be UTC date. level: 'debug', // info level to be stored in this log file. filename: ${logDirName}-debug_%DATE%.log, // format of the file name. datePattern: 'YYYYMMDD' // date pattern in the file name });

Please let me know if any change required in this. Any help is much appreciated.

ankityadav1 commented 2 years ago

I am experiencing similar issue.

For me when the file rotation is supposed to occur, the original log file keeps getting bigger and rotation duplicates the log files into smaller files.

I need the original file to be empty after rotation.

Is there a solution for it or a workaround?

wbt commented 2 years ago

@ankityadav1 Do you think #333 you just opened is a duplicate of this one, or is it a distinct issue?

ankityadav1 commented 2 years ago

I think mine is distinct because for me rotation is happening and my concern is not frequency but original log file not being rotated!