Search code examples
winston

Winston logging. Roll over but keep same file name


I am using winston for logging.

I have the log files roll over after a certain size. So they would look like
myLog.log
MyLog1.log

But it starts using the myLog1 as the new log file. I want it to keep writing to myLog.log and have myLog1 as the old one. Is there a way to do this?


Solution

  • I found a there is an option that can be used. tailable. If this option is set to true then it will work as described in the question.

        new winston.transports.File({
            filename: logLocation,
            handleExceptions: true,
            json: true,
            maxsize: 100000,
            maxFiles: 5,
            colorize: false,
            tailable: true
        }),