From 7d9fdc9d29cf1080850672cf0061e24ef440b822 Mon Sep 17 00:00:00 2001 From: Jimmy Hunag Date: Sun, 29 Jul 2018 03:18:41 +0800 Subject: [PATCH] chore: add clone comment in configure --- lib/log4js.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/log4js.js b/lib/log4js.js index 69faa63..427f937 100644 --- a/lib/log4js.js +++ b/lib/log4js.js @@ -58,7 +58,11 @@ function configure(configurationFileOrObject) { configObject = loadConfigurationFile(configurationFileOrObject); } debug(`Configuration is ${configObject}`); - configuration.configure(CircularJSON.parse(CircularJSON.stringify(configObject))); + + // Keep the configObject remain the same + // and clone it to avoid that is not configurable in appenders + const clonedConfigObject = CircularJSON.parse(CircularJSON.stringify(configObject)); + configuration.configure(clonedConfigObject); clustering.onMessage(sendLogEventToAppender);