3

I have run in to a weird bug and don't know how to proceed/debug. I have an app that's written in Nodejs and uses Winston for logging. Everything was working fine until I brought up a new production server yesterday and retired the old one.

My prod server has 4 Nodejs processes running. On the new production server, Winston logs the very first log message per .js file, period. It stops logging after that, and changing the log level doesn't work. My app has got about 6 .js files, and in case of any error on any of those files, the very first error message gets logged but any subsequent errors/warning/info are not logged.

The funny thing is Winston was working just fine on the old prod server and the dev server still works fine.

I am on Winston 0.6.2 on both dev and prod. As far as I know, all the sw packages are the same between dev and prod.

How can I debug this issue?

4

3 回答 3

4

After some research, I came across this issue => https://github.com/flatiron/winston/issues/227

Looks like, the new way of handling streams in the latest version of node has broken file transport in winston. I am going back to node v0.8.22 for the time being as a work around.

于 2013-04-01T21:14:14.413 回答
0

What transports are you using for logging? Does the console transport work? Perhaps the new production server has a network issue that prevents it logging to a remote service such as CouchDB or Loggly.

If you add a simple console.log('...') line next to your winston log lines do those get fired. This will confirm or deny that your winston log lines are getting called on the production server

winston.info('winston log test')
console.log('console log test')
于 2013-03-30T15:15:07.070 回答
0

You can can expose the logger instance and have a URL to trigger the required log level. I had the same need so I came up with a dynamic log level setter for Winston https://github.com/yannvr/Winston-dynamic-loglevel

于 2014-08-07T14:53:30.863 回答