Added better server log errors
This commit is contained in:
parent
9f63552b81
commit
a118b91b79
4 changed files with 26 additions and 0 deletions
21
imports/startup/server/catchExceptions.js
Normal file
21
imports/startup/server/catchExceptions.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import ravenLogger from '/imports/startup/server/ravenLogger';
|
||||
|
||||
Meteor.startup(() => {
|
||||
const bound = Meteor.bindEnvironment((callback) => { callback(); });
|
||||
process.on('uncaughtException', (err) => {
|
||||
bound(() => {
|
||||
// console.error('Server crashed!', err);
|
||||
console.error(err);
|
||||
// console.error(err.stack);
|
||||
|
||||
// https://github.com/flowkey/meteor-raven
|
||||
ravenLogger.log(err);
|
||||
|
||||
// https://github.com/nodejs/node-v0.x-archive/blob/master/doc/api/process.markdown#exit-codes
|
||||
process.exit(7);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import './ravenLogger';
|
||||
import './catchExceptions';
|
||||
import './i18n';
|
||||
import './accounts';
|
||||
import './api';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { Meteor } from 'meteor/meteor';
|
|||
const ravenOptions = {};
|
||||
|
||||
const ravenLogger = new RavenLogger({
|
||||
publicDSN: Meteor.settings.public.sentryPublicDSN,
|
||||
privateDSN: Meteor.settings.sentryPrivateDSN,
|
||||
shouldCatchConsoleError: true, // default true
|
||||
trackUser: true // default false
|
||||
|
|
|
|||
|
|
@ -20,3 +20,6 @@ SegfaultHandler.registerHandler(`/var/tmp/tcef-stacktrace-${dateFileFormat}.log`
|
|||
|
||||
// Only uncomment for segv tests
|
||||
// SegfaultHandler.causeSegfault();
|
||||
|
||||
// Or this for normal error (should go to raven in configured)
|
||||
// throw new Error('This is just a test of error in server');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue