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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new dfd21bd2a04 [fix](fe-log) add position info in async mode #39419 
(#39571)
dfd21bd2a04 is described below

commit dfd21bd2a04c9ecdf35656e5bbcc2c08968501e9
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Tue Aug 20 22:01:34 2024 +0800

    [fix](fe-log) add position info in async mode #39419 (#39571)
    
    pick part of #39419
---
 .../src/main/java/org/apache/doris/common/Config.java      | 14 +++++++-------
 .../src/main/java/org/apache/doris/common/Log4jConfig.java |  9 +++++++--
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java 
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index 35fdac59685..6a0394a0be7 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -70,13 +70,13 @@ public class Config extends ConfigBase {
     @ConfField(description = {"FE 日志的级别", "The level of FE log"}, options = 
{"INFO", "WARN", "ERROR", "FATAL"})
     public static String sys_log_level = "INFO";
 
-    @ConfField(description = {"FE 日志的输出模式,其中 NORMAL 为默认的输出模式,日志同步输出且包含位置信息,"
-            + "BRIEF 模式是日志同步输出但不包含位置信息,ASYNC 
模式是日志异步输出且不包含位置信息,三种日志输出模式的性能依次递增",
-            "The output mode of FE log, and NORMAL mode is the default output 
mode, which means the logs are "
-                    + "synchronized and contain location information. BRIEF 
mode is synchronized and does not contain"
-                    + " location information. ASYNC mode is asynchronous and 
does not contain location information."
-                    + " The performance of the three log output modes 
increases in sequence"},
-            options = {"NORMAL", "BRIEF", "ASYNC"})
+    @ConfField(description = {"FE 日志的输出模式,其中 NORMAL 模式是日志同步输出且包含位置信息;ASYNC 
模式为默认模式,日志异步输出"
+            + "且包含位置信息;BRIEF 是日志异步输出但不包含位置信息,三种日志输出模式的性能依次递增",
+            "The output mode of FE log. NORMAL mode is synchronous output with 
location information; "
+                    + "ASYNC mode is the default mode, asynchronous output 
with location information; "
+                    + "BRIEF is asynchronous output without location 
information. "
+                    + "The performance of the three log output modes increases 
in turn"},
+            options = {"NORMAL", "ASYNC", "BRIEF"})
     public static String sys_log_mode = "NORMAL";
 
     @ConfField(description = {"FE 日志文件的最大数量。超过这个数量后,最老的日志文件会被删除",
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 5395de076ae..206d1cb2089 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
@@ -298,8 +298,13 @@ 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));
 
-        properties.put("include_location_flag", 
sysLogMode.equalsIgnoreCase("NORMAL") ? "true" : "false");
-        properties.put("immediate_flush_flag", 
sysLogMode.equalsIgnoreCase("ASYNC") ? "false" : "true");
+        // 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" : "");
 
         strSub = new StrSubstitutor(new Interpolator(properties));


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

Reply via email to