From 04ee853cecf45ffb9ff7cb144d1225d5588b3982 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Thu, 22 Jan 2015 07:45:55 +1100 Subject: [PATCH] Add the logger earlier in the Aphlict startup process Summary: Add the logger as soon as possible so that the log file will contain errors if the `ws` module cannot be loaded. Test Plan: Ran `./bin/aphlict debug` without having the `ws` module installed. Saw errors in the logs. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11457 --- support/aphlict/server/aphlict_server.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js index 692bb0d536..a567b0874f 100644 --- a/support/aphlict/server/aphlict_server.js +++ b/support/aphlict/server/aphlict_server.js @@ -70,6 +70,11 @@ process.on('uncaughtException', function(err) { set_exit_code(1); }); +// Add the logfile so we'll fail if we can't write to it. +if (config.log) { + debug.addLog(config.log); +} + try { require('ws'); } catch (ex) { @@ -96,11 +101,6 @@ if (ssl_config.enabled) { ssl_config.cert = fs.readFileSync(config['ssl-cert']); } -// Add the logfile so we'll fail if we can't write to it. -if (config.log) { - debug.addLog(config.log); -} - // If we're just doing a configuration test, exit here before starting any // servers. if (config.test) {