diff --git a/box.js b/box.js index 68e235933..3192294e8 100755 --- a/box.js +++ b/box.js @@ -2,12 +2,16 @@ 'use strict'; -require('supererror')({ splatchError: true }); +// prefix all output with a timestamp +// debug() already prefixes and uses process.stderr NOT console.* +['log', 'info', 'warn', 'debug', 'error'].forEach(function (log) { + var orig = console[log]; + console[log] = function () { + orig.apply(console, [new Date().toISOString()].concat(Array.prototype.slice.call(arguments))); + }; +}); -// remove timestamp from debug() based output -require('debug').formatArgs = function formatArgs(args) { - args[0] = this.namespace + ' ' + args[0]; -}; +require('supererror')({ splatchError: true }); let async = require('async'), config = require('./src/config.js'), diff --git a/setup/start/systemd/box.service b/setup/start/systemd/box.service index f6672d410..98606f043 100644 --- a/setup/start/systemd/box.service +++ b/setup/start/systemd/box.service @@ -13,7 +13,7 @@ Type=idle WorkingDirectory=/home/yellowtent/box Restart=always ; Systemd does not append logs when logging to files, we spawn a shell first and exec to replace it after setting up the pipes -ExecStart=/bin/sh -c 'exec /usr/bin/node --max_old_space_size=150 /home/yellowtent/box/box.js >> /home/yellowtent/platformdata/logs/box.log 2>&1' +ExecStart=/bin/sh -c 'echo "Logging to /home/yellowtent/platformdata/logs/box.log"; exec /usr/bin/node --max_old_space_size=150 /home/yellowtent/box/box.js >> /home/yellowtent/platformdata/logs/box.log 2>&1' Environment="HOME=/home/yellowtent" "USER=yellowtent" "DEBUG=box*,connect-lastmile" "BOX_ENV=cloudron" "NODE_ENV=production" ; kill apptask processes as well KillMode=control-group