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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 47387a2a2eb [chor](log) Change log4j rollover strategy to 'max' 
(#32116)
47387a2a2eb is described below

commit 47387a2a2eb37eb4e59a81a442d25c5127a911ba
Author: Gavin Chou <[email protected]>
AuthorDate: Wed Mar 20 14:11:58 2024 +0800

    [chor](log) Change log4j rollover strategy to 'max' (#32116)
    
    The log file names are in the format fe.log.${date}-${index}, e.g.
    ```
    fe.log.20240311-1
    fe.log.20240311-2
    fe.log.20240311-3
    ...
    ```
    In the previous, fe.log/fe.audit.log will be renamed to 
fe.log.xxx-1/fe.audit.log.xxx-1
    with the minimum index `1` when they reach rotation size. e.g.
    ```
    fe.log.20240311-1 -> fe.log.20240311-2
    fe.log.20240311-2 -> fe.log.20240311-3
    fe.log.20240311-3 -> fe.log.20240311-4
    fe.log            -> fe.log.20240311-1
    ```
    
    there are some drawbacks
    1. log4j needs to rename all existing rotated log to spare the
       index `1`
    2. it's hard to deal with the duplicated names, because every time the
       log rotates, it starts from index `1`
    
    After this change, the log will rename to a file name with larger index
    instead of `1`. e.g. when rotate
    ```
    fe.log.20240311-1
    fe.log.20240311-2
    fe.log.20240311-3
    fe.log -> fe.log.20240311-4
    ```
---
 fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java | 6 +++---
 1 file changed, 3 insertions(+), 3 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 3c72048e00b..47d96765a9c 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
@@ -56,7 +56,7 @@ public class Log4jConfig extends XmlConfiguration {
             + "        <TimeBasedTriggeringPolicy/>\n"
             + "        <SizeBasedTriggeringPolicy 
size=\"${sys_roll_maxsize}MB\"/>\n"
             + "      </Policies>\n"
-            + "      <DefaultRolloverStrategy max=\"${sys_roll_num}\" 
fileIndex=\"min\">\n"
+            + "      <DefaultRolloverStrategy max=\"${sys_roll_num}\" 
fileIndex=\"max\">\n"
             + "        <Delete basePath=\"${sys_log_dir}/\" maxDepth=\"1\">\n"
             + "          <IfFileName glob=\"fe.log.*\" />\n"
             + "          <IfLastModified age=\"${sys_log_delete_age}\" />\n"
@@ -71,7 +71,7 @@ public class Log4jConfig extends XmlConfiguration {
             + "        <TimeBasedTriggeringPolicy/>\n"
             + "        <SizeBasedTriggeringPolicy 
size=\"${sys_roll_maxsize}MB\"/>\n"
             + "      </Policies>\n"
-            + "      <DefaultRolloverStrategy max=\"${sys_roll_num}\" 
fileIndex=\"min\">\n"
+            + "      <DefaultRolloverStrategy max=\"${sys_roll_num}\" 
fileIndex=\"max\">\n"
             + "        <Delete basePath=\"${sys_log_dir}/\" maxDepth=\"1\">\n"
             + "          <IfFileName glob=\"fe.warn.log.*\" />\n"
             + "          <IfLastModified age=\"${sys_log_delete_age}\" />\n"
@@ -86,7 +86,7 @@ public class Log4jConfig extends XmlConfiguration {
             + "        <TimeBasedTriggeringPolicy/>\n"
             + "        <SizeBasedTriggeringPolicy 
size=\"${audit_roll_maxsize}MB\"/>\n"
             + "      </Policies>\n"
-            + "      <DefaultRolloverStrategy max=\"${audit_roll_num}\" 
fileIndex=\"min\">\n"
+            + "      <DefaultRolloverStrategy max=\"${audit_roll_num}\" 
fileIndex=\"max\">\n"
             + "        <Delete basePath=\"${audit_log_dir}/\" 
maxDepth=\"1\">\n"
             + "          <IfFileName glob=\"fe.audit.log.*\" />\n"
             + "          <IfLastModified age=\"${audit_log_delete_age}\" />\n"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to