From 8fa99fae1a369ad23c8ce59e0a969c8c9f177e49 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 4 Jun 2018 20:22:32 +0200 Subject: [PATCH] Put all apptask logs of an app in the same log file --- src/apptask.js | 2 ++ src/taskmanager.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/apptask.js b/src/apptask.js index 1b864e732..648e93b22 100644 --- a/src/apptask.js +++ b/src/apptask.js @@ -785,6 +785,8 @@ function startTask(appId, callback) { if (require.main === module) { assert.strictEqual(process.argv.length, 3, 'Pass the appid as argument'); + // add a separator for the log file + debug('------------------------------------------------------------'); debug('Apptask for %s', process.argv[2]); process.on('SIGTERM', function () { diff --git a/src/taskmanager.js b/src/taskmanager.js index b0de865a3..9b22413ea 100644 --- a/src/taskmanager.js +++ b/src/taskmanager.js @@ -128,10 +128,10 @@ function startAppTask(appId, callback) { // ensure log folder mkdirp.sync(path.join(paths.LOG_DIR, appId)); - var logFilePath = path.join(paths.LOG_DIR, appId, 'apptask-' + Date.now() + '.log'); + var logFilePath = path.join(paths.LOG_DIR, appId, 'apptask.log'); // will autoclose - fs.open(logFilePath, 'w', function (error, fd) { + fs.open(logFilePath, 'a', function (error, fd) { if (error) { debug('Unable to open log file, queueing task for %s', appId, error); gPendingTasks.push(appId);