DongLiang-0 commented on code in PR #24861:
URL: https://github.com/apache/doris/pull/24861#discussion_r1338286846


##########
fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java:
##########
@@ -228,11 +229,22 @@ private static void reconfig() throws IOException {
         SpringLog4j2Config.writeSpringLogConf(customConfDir);
 
         // new SimpleLog4jConfiguration with xmlConfTemplate
-        ByteArrayInputStream bis = new 
ByteArrayInputStream(newXmlConfTemplate.getBytes("UTF-8"));
-        ConfigurationSource source = new ConfigurationSource(bis);
-        Log4jConfig config = new Log4jConfig(source);
+        if (newXmlConfTemplate == null || newXmlConfTemplate.isEmpty()) {
+            throw new IOException("The configuration template is empty!");
+        }
+
+        Log4jConfig config;
+        try (ByteArrayInputStream bis = new 
ByteArrayInputStream(newXmlConfTemplate.getBytes(StandardCharsets.UTF_8))) {
+            ConfigurationSource source = new ConfigurationSource(bis);
+            config = new Log4jConfig(source);
+
+            LoggerContext context = (LoggerContext) 
LogManager.getContext(false);
+            context.start(config);

Review Comment:
   I see that `context.start(config)` is called on both lines 248 and 242. Do 
we need to call start twice here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to