diff --git a/TaskServer/.env b/TaskServer/.env index e86403577..6c6c4dc8a 100644 --- a/TaskServer/.env +++ b/TaskServer/.env @@ -6,7 +6,7 @@ REQUIRED_PROJECTS_PATH=../Projects PROJECTS_PATH=../Projects USE_KEYVAULT=false -WRITE_LOGS_TO_FILES=true + LOG_PATH=../Log-Files WEB_SOCKETS_INTERFACE_PORT=18041 diff --git a/TaskServer/Globals.js b/TaskServer/Globals.js index 054879cc4..6fe63da21 100644 --- a/TaskServer/Globals.js +++ b/TaskServer/Globals.js @@ -27,19 +27,11 @@ exports.newGlobals = function () { } global.SHUTTING_DOWN_PROCESS = false - - - - require('dotenv').config(); - - global.WRITE_LOGS_TO_FILES = process.env.WRITE_LOGS_TO_FILES - /* We need to count how many process instances we deployd and how many of them have already finished their job, either because they just finished or because there was a request to stop the proceses. In this way, once we reach the amount of instances started, we can safelly destroy the rest of the objects running and let this nodejs process die. */ - global.ENDED_PROCESSES_COUNTER = 0 global.TOTAL_PROCESS_INSTANCES_CREATED = 0 diff --git a/TaskServer/IndicatorBot.js b/TaskServer/IndicatorBot.js index e24c8e7a9..16d331354 100644 --- a/TaskServer/IndicatorBot.js +++ b/TaskServer/IndicatorBot.js @@ -702,9 +702,7 @@ logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds.") nextLoopTimeoutHandle = setTimeout(loop, processConfig.normalWaitTime); processHeartBeat(undefined, undefined, "Waiting " + processConfig.normalWaitTime / 1000 + " seconds for next execution.") - if (global.WRITE_LOGS_TO_FILES === 'true') { - logger.persist(); - } + logger.persist(); } break; case 'Retry': { diff --git a/TaskServer/ReinforcementLearning/LearningBot.js b/TaskServer/ReinforcementLearning/LearningBot.js index 15ae914c7..474ac1e15 100644 --- a/TaskServer/ReinforcementLearning/LearningBot.js +++ b/TaskServer/ReinforcementLearning/LearningBot.js @@ -529,10 +529,7 @@ exports.newLearningBot = function newLearningBot(bot, parentLogger) { function onStop() { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> onStop -> Stopping the Loop Gracefully. See you next time!"); } - - if (global.WRITE_LOGS_TO_FILES === 'true') { - logger.persist(); - } + logger.persist(); global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.sessionKey, 'Stopped') processStopped() diff --git a/TaskServer/SensorBot.js b/TaskServer/SensorBot.js index 8932fba88..77af290fd 100644 --- a/TaskServer/SensorBot.js +++ b/TaskServer/SensorBot.js @@ -498,9 +498,7 @@ logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds.") nextLoopTimeoutHandle = setTimeout(loop, processConfig.normalWaitTime); processHeartBeat(undefined, undefined, "Waiting " + processConfig.normalWaitTime / 1000 + " seconds for next execution.") - if (global.WRITE_LOGS_TO_FILES === 'true') { - logger.persist(); - } + logger.persist(); } break; case 'Retry': { diff --git a/TaskServer/TradingBot.js b/TaskServer/TradingBot.js index 914dd98f2..7f29f537c 100644 --- a/TaskServer/TradingBot.js +++ b/TaskServer/TradingBot.js @@ -529,10 +529,7 @@ function onStop() { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> onStop -> Stopping the Loop Gracefully. See you next time!") - - if (global.WRITE_LOGS_TO_FILES === 'true') { - logger.persist(); - } + logger.persist(); global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.TRADING_SESSIONKey, 'Stopped') processStopped()