Skip to content
Snippets Groups Projects
Commit 44d93a11 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Merge pull request #1651 from mozilla/issue1558

rework uncaught exception handling: log an error, don't bring the proces...

After reading the referenced article, it makes me wonder whether logging and continuing is the proper approach, a complete process restart does seem too severe.

r+ - an easy change.  

close #1558
parents 58456b85 3d2ca1fb
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ exports.logger = new (winston.Logger)({ ...@@ -40,7 +40,7 @@ exports.logger = new (winston.Logger)({
timestamp: function () { return new Date().toISOString() }, timestamp: function () { return new Date().toISOString() },
filename: filename, filename: filename,
colorize: true, colorize: true,
handleExceptions: !!process.env['LOG_TO_CONSOLE'] handleExceptions: true
})] })]
}); });
...@@ -51,6 +51,6 @@ exports.enableConsoleLogging = function() { ...@@ -51,6 +51,6 @@ exports.enableConsoleLogging = function() {
}); });
}; };
if (process.env['LOG_TO_CONSOLE']) exports.enableConsoleLogging(); if (process.env['LOG_TO_CONSOLE']) exports.enableConsoleLogging();
exports.logger.exitOnError = false;
...@@ -29,3 +29,7 @@ if (statsd_config && statsd_config.enabled) { ...@@ -29,3 +29,7 @@ if (statsd_config && statsd_config.enabled) {
statsd = new StatsD(options["host"], options["port"]); statsd = new StatsD(options["host"], options["port"]);
} }
process.on('uncaughtException', function(err) {
if (statsd) statsd.increment(PREFIX + 'uncaught_exception');
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment