flatiron/winston — Issue #73: How to handle uncaught exceptions
Author: langxangvn
Created: 2011-12-02 18:48:42+00:00
State: open

I want to log the uncaught exceptions with Winston and exit process. I've configured logger like this

var winston = require('winston');
var logger = new (winston.Logger)({
transports: [
new winston.transports.File({ filename: './all-logs.log', timestamp: true, maxsize: 1000000 })
],
exceptionHandlers: [
new winston.transports.File({ filename: './exceptions.log', timestamp: true, maxsize: 1000000 })
],
exitOnError: true,
});

Then try throw one error, but no exceptions.logs file was created
throw new Exception("Error here ...");

Did I have the right configuration?