From a5e2900ae908e9c8345823d635085b94355a0680 Mon Sep 17 00:00:00 2001 From: morningman Date: Thu, 15 Aug 2024 16:15:19 +0800 Subject: [PATCH 1/3] [fix](fe-log) add position info in async mode --- .../src/main/java/org/apache/doris/common/Log4jConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 5395de076ae223..6008a12a0628b0 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,7 +298,8 @@ private static void reconfig() throws IOException { 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("include_location_flag", (sysLogMode.equalsIgnoreCase("NORMAL") + || sysLogMode.equalsIgnoreCase("ASYNC")) ? "true" : "false"); properties.put("immediate_flush_flag", sysLogMode.equalsIgnoreCase("ASYNC") ? "false" : "true"); properties.put("audit_file_postfix", compressAuditLog ? ".gz" : ""); From 6b8a1f83b9a9212190ef96000d919abd9b89d12f Mon Sep 17 00:00:00 2001 From: morningman Date: Thu, 15 Aug 2024 16:15:50 +0800 Subject: [PATCH 2/3] [fix](fe-log) add position info in async mode --- .../src/main/java/org/apache/doris/common/Log4jConfig.java | 3 +-- 1 file changed, 1 insertion(+), 2 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 6008a12a0628b0..fb07a49f696b08 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,7 @@ private static void reconfig() throws IOException { 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") - || sysLogMode.equalsIgnoreCase("ASYNC")) ? "true" : "false"); + properties.put("include_location_flag", sysLogMode.equalsIgnoreCase("BRIEF") ? "false" : "true"); properties.put("immediate_flush_flag", sysLogMode.equalsIgnoreCase("ASYNC") ? "false" : "true"); properties.put("audit_file_postfix", compressAuditLog ? ".gz" : ""); From 282a4b9cc7ae682ea29868fd789168e4017d2a19 Mon Sep 17 00:00:00 2001 From: morningman Date: Fri, 16 Aug 2024 09:36:07 +0800 Subject: [PATCH 3/3] 1 --- .../main/java/org/apache/doris/common/Config.java | 14 +++++++------- .../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 8dcc2bbef95aff..45f82a023a1268 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 @@ -72,13 +72,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 means the logs are synchronized and contain location " - + "information. BRIEF mode is synchronized and does not contain location information. " - + "ASYNC mode is the default output mode, which 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 = "ASYNC"; @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 fb07a49f696b08..206d1cb208959b 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 @@ private static void reconfig() throws IOException { 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("BRIEF") ? "false" : "true"); - 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));