This is an automated email from the ASF dual-hosted git repository.

gavinchou pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 57ea4fb1109f5690b37f0b9c858e03681d1a571f
Author: caiconghui <55968745+caicong...@users.noreply.github.com>
AuthorDate: Tue Sep 10 15:59:53 2024 +0800

    [fix](log) fix fe doesn't print location in log when log mode is async 
(#40513)
    
    Co-authored-by: caiconghui1 <caicongh...@jd.com>
---
 .../main/java/org/apache/doris/common/Log4jConfig.java | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java
index 206d1cb2089..39d13b0e989 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java
@@ -252,13 +252,18 @@ public class Log4jConfig extends XmlConfiguration {
         }
         newXmlConfTemplate = 
newXmlConfTemplate.replaceAll(VERBOSE_MODULE_PLACEHOLDER, sb.toString());
 
-        if (sysLogMode.equalsIgnoreCase("NORMAL")) {
+        // BRIEF: async, no location
+        // ASYNC: async, with location
+        // NORMAL: sync, with location
+        boolean includeLocation = !sysLogMode.equalsIgnoreCase("BRIEF");
+        boolean immediateFlush = sysLogMode.equalsIgnoreCase("NORMAL");
+        if (includeLocation) {
             newXmlConfTemplate = 
newXmlConfTemplate.replaceAll(RUNTIME_LOG_FORMAT_PLACEHOLDER, " [%C{1}.%M():%L] 
");
         } else {
             newXmlConfTemplate = 
newXmlConfTemplate.replaceAll(RUNTIME_LOG_FORMAT_PLACEHOLDER, " ");
-            if (sysLogMode.equalsIgnoreCase("ASYNC")) {
-                newXmlConfTemplate = newXmlConfTemplate.replaceAll("Root", 
"AsyncRoot");
-            }
+        }
+        if (!immediateFlush) {
+            newXmlConfTemplate = newXmlConfTemplate.replaceAll("Root", 
"AsyncRoot");
         }
 
         if (Config.enable_file_logger) {
@@ -298,11 +303,6 @@ public class Log4jConfig extends XmlConfiguration {
         properties.put("warn_sys_accumulated_file_size", 
String.valueOf(Config.warn_sys_accumulated_file_size));
         properties.put("audit_sys_accumulated_file_size", 
String.valueOf(Config.audit_sys_accumulated_file_size));
 
-        // BRIEF: async, no location
-        // ASYNC: async, with location
-        // NORMAL: sync, with location
-        boolean includeLocation = !sysLogMode.equalsIgnoreCase("BRIEF");
-        boolean immediateFlush = sysLogMode.equalsIgnoreCase("NORMAL");
         properties.put("include_location_flag", 
Boolean.toString(includeLocation));
         properties.put("immediate_flush_flag", 
Boolean.toString(immediateFlush));
         properties.put("audit_file_postfix", compressAuditLog ? ".gz" : "");


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

Reply via email to