diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php index cc21d68d6f..59ba40b8a4 100644 --- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php @@ -136,9 +136,7 @@ abstract class PhabricatorAphlictManagementWorkflow $server_argv[] = '--ssl-cert='.$ssl_cert; } - if (!$this->debug) { - $server_argv[] = '--log='.$log; - } + $server_argv[] = '--log='.$log; if ($this->clientHost) { $server_argv[] = '--client-host='.$this->clientHost; diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js index 9649c50c8a..aa5784f16b 100644 --- a/support/aphlict/server/aphlict_server.js +++ b/support/aphlict/server/aphlict_server.js @@ -43,7 +43,25 @@ var debug = new JX.AphlictLog() var config = parse_command_line_arguments(process.argv); process.on('uncaughtException', function(err) { - debug.log('\n<<< UNCAUGHT EXCEPTION! >>>\n' + err.stack); + var context = null; + if ((err.code == 'EACCES') && + (err.path == config.log)) { + context = util.format( + 'Unable to open logfile ("%s"). Check that permissions are set ' + + 'correctly.', + err.path); + } + + var message = [ + '\n<<< UNCAUGHT EXCEPTION! >>>', + ]; + if (context) { + message.push(context); + } + message.push(err.stack); + + debug.log(message.join('\n\n')); + process.exit(1); }); @@ -69,8 +87,8 @@ if (ssl_config.enabled) { } // Add the logfile so we'll fail if we can't write to it. -if (config.logfile) { - debug.addLogfile(config.logfile); +if (config.log) { + debug.addLogfile(config.log); } // If we're just doing a configuration test, exit here before starting any diff --git a/support/aphlict/server/lib/AphlictLog.js b/support/aphlict/server/lib/AphlictLog.js index 73b9031194..15c7dbc719 100644 --- a/support/aphlict/server/lib/AphlictLog.js +++ b/support/aphlict/server/lib/AphlictLog.js @@ -20,7 +20,7 @@ JX.install('AphlictLog', { mode: 066 }; - var logfile = fs.createWriteSteam(path, options); + var logfile = fs.createWriteStream(path, options); this._writeToLogs.push(logfile);