diff --git a/lib/logging.js b/lib/logging.js index d868df2f772c92da03767466d3abd83d5818029a..058d161869a7e3113ef506304a6f8b81e16e8c0e 100644 --- a/lib/logging.js +++ b/lib/logging.js @@ -40,7 +40,7 @@ exports.logger = new (winston.Logger)({ timestamp: function () { return new Date().toISOString() }, filename: filename, colorize: true, - handleExceptions: !!process.env['LOG_TO_CONSOLE'] + handleExceptions: true })] }); @@ -51,6 +51,6 @@ exports.enableConsoleLogging = function() { }); }; - - if (process.env['LOG_TO_CONSOLE']) exports.enableConsoleLogging(); + +exports.logger.exitOnError = false; diff --git a/lib/statsd.js b/lib/statsd.js index 0e231f3c2383ea92234d4594eee9211548585b86..f7278dca5628b18f7f7329cb04043078822ef653 100644 --- a/lib/statsd.js +++ b/lib/statsd.js @@ -29,3 +29,7 @@ if (statsd_config && statsd_config.enabled) { statsd = new StatsD(options["host"], options["port"]); } + +process.on('uncaughtException', function(err) { + if (statsd) statsd.increment(PREFIX + 'uncaught_exception'); +});