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

Received unknown write error #301

Closed ghost closed 3 years ago

ghost commented 3 years ago

We received the following error on our test service, causing it to crash. We don't know what caused it either. All I can say is that it's on a portable hdd.

node:events:356
      throw er; // Unhandled 'error' event
      ^

Error: UNKNOWN: unknown error, write
Emitted 'error' event at:
    at WriteStream.<anonymous> (E:\Projects\Node\Stew2\node_modules\file-stream-rotator\FileStreamRotator.js:677:15
mattberther commented 3 years ago

@Zaseth Additional information might be valuable here. Can you please post your configuration object, relevant node/winston/winston-daily-rotate-file verions, and a complete stack trace?

ghost commented 3 years ago

@mattberther I sadly don't have a stack trace... We're using v4.5.0 and for logging things we do the following:

const textFormat = printf(({ level, message, timestamp }) => {
  return `[\x1b[36m${timestamp}\x1b[0m] [${level}] \x1b[35m>\x1b[0m ${message}`
})

const { debug } = createLogger({
  levels: { debug: 7 },
  transports: [
    new transports.DailyRotateFile({
      level: 'debug',
      maxFiles: '1d',
      filename: `./logs/${process.argv[2]}/debug@%DATE%.log`,
      datePattern: 'D-M-YYYY',
      format: combine(timestamp({ format: 'HH:mm:ss' }), json())
    }),
    new transports.Console({
      level: 'debug',
      format: combine(colorize(), timestamp({ format: 'HH:mm:ss' }), textFormat)
    })
  ]
})
ghost commented 3 years ago

Any news on this?

mattberther commented 3 years ago

I have been unable to reproduce this error. If you have a way to reliably reproduce this issue, please provide the smallest possible program that demonstrates this issue. Thank you.

ghost commented 3 years ago

@mattberther I don't have anything to provide other than the following:

I know things would've been better with a stack trace, but none was given and this is all I know. I'm guessing it has something to do with the portable HDD being frozen, disallowing the daily rotate file not to be written. Feel free to close the issue if you want, it hasn't happened ever on our servers so that's a good sign I guess.

mattberther commented 3 years ago

Thank you. I'll close out, but please re-open if you have a way to consistently reproduce this problem.