morningman commented on code in PR #34446: URL: https://github.com/apache/doris/pull/34446#discussion_r1591182396
########## fe/fe-common/src/main/java/org/apache/doris/common/Config.java: ########## @@ -2606,6 +2606,11 @@ public class Config extends ConfigBase { //========================================================================== // begin of cloud config //========================================================================== + @ConfField(description = {"是否启用FE 日志文件按照大小删除策略,当日志大小超过指定大小,删除相关的log。默认关闭,为按照时间策略删除", + "Whether to enable the FE log file deletion policy based on size, " + + "where logs exceeding the specified size are deleted. " + + "It is disabled by default and follows a time-based deletion policy."}) + public static boolean log_by_size = false; Review Comment: Better use a enum type like: `public static String log_rollover_strategy = "age"` The options are `size` or `age`. And don't forget to add the `option` field of `@ConfField` ########## fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java: ########## @@ -39,81 +39,114 @@ public class Log4jConfig extends XmlConfiguration { private static final long serialVersionUID = 1L; - // CHECKSTYLE OFF - private static String xmlConfTemplate = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" - + "\n<!-- Auto Generated. DO NOT MODIFY IT! -->\n" - + "<Configuration status=\"info\" packages=\"org.apache.doris.common\">\n" - + " <Appenders>\n" - + " <Console name=\"Console\" target=\"SYSTEM_OUT\">" - + " <PatternLayout charset=\"UTF-8\">\n" - + " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n" - + " </PatternLayout>\n" - + " </Console>" - + " <RollingFile name=\"Sys\" fileName=\"${sys_log_dir}/fe.log\" filePattern=\"${sys_log_dir}/fe.log.${sys_file_pattern}-%i${sys_file_postfix}\" immediateFlush=\"${immediate_flush_flag}\">\n" - + " <PatternLayout charset=\"UTF-8\">\n" - + " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n" - + " </PatternLayout>\n" - + " <Policies>\n" - + " <TimeBasedTriggeringPolicy/>\n" - + " <SizeBasedTriggeringPolicy size=\"${sys_roll_maxsize}MB\"/>\n" - + " </Policies>\n" - + " <DefaultRolloverStrategy max=\"${sys_roll_num}\" fileIndex=\"max\">\n" - + " <Delete basePath=\"${sys_log_dir}/\" maxDepth=\"1\">\n" - + " <IfFileName glob=\"fe.log.*\" />\n" - + " <IfAny>\n" - + " <IfAccumulatedFileSize exceeds=\"${info_sys_accumulated_file_size}GB\"/>\n" - + " </IfAny>\n" - + " </Delete>\n" - + " </DefaultRolloverStrategy>\n" - + " </RollingFile>\n" - + " <RollingFile name=\"SysWF\" fileName=\"${sys_log_dir}/fe.warn.log\" filePattern=\"${sys_log_dir}/fe.warn.log.${sys_file_pattern}-%i${sys_file_postfix}\" immediateFlush=\"${immediate_flush_flag}\">\n" - + " <PatternLayout charset=\"UTF-8\">\n" - + " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n" - + " </PatternLayout>\n" - + " <Policies>\n" - + " <TimeBasedTriggeringPolicy/>\n" - + " <SizeBasedTriggeringPolicy size=\"${sys_roll_maxsize}MB\"/>\n" - + " </Policies>\n" - + " <DefaultRolloverStrategy max=\"${sys_roll_num}\" fileIndex=\"max\">\n" - + " <Delete basePath=\"${sys_log_dir}/\" maxDepth=\"1\">\n" - + " <IfFileName glob=\"fe.warn.log.*\" />\n" - + " <IfAny>\n" - + " <IfAccumulatedFileSize exceeds=\"${warn_sys_accumulated_file_size}GB\"/>\n" - + " </IfAny>\n" - + " </Delete>\n" - + " </DefaultRolloverStrategy>\n" - + " </RollingFile>\n" - + " <RollingFile name=\"Auditfile\" fileName=\"${audit_log_dir}/fe.audit.log\" filePattern=\"${audit_log_dir}/fe.audit.log.${audit_file_pattern}-%i${audit_file_postfix}\">\n" - + " <PatternLayout charset=\"UTF-8\">\n" - + " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} [%c{1}] %m%n</Pattern>\n" - + " </PatternLayout>\n" - + " <Policies>\n" - + " <TimeBasedTriggeringPolicy/>\n" - + " <SizeBasedTriggeringPolicy size=\"${audit_roll_maxsize}MB\"/>\n" - + " </Policies>\n" - + " <DefaultRolloverStrategy max=\"${audit_roll_num}\" fileIndex=\"max\">\n" - + " <Delete basePath=\"${audit_log_dir}/\" maxDepth=\"1\">\n" - + " <IfFileName glob=\"fe.audit.log.*\" />\n" - + " <IfAny>\n" - + " <IfAccumulatedFileSize exceeds=\"${audit_sys_accumulated_file_size}GB\"/>\n" - + " </IfAny>\n" - + " </Delete>\n" - + " </DefaultRolloverStrategy>\n" - + " </RollingFile>\n" - + " </Appenders>\n" - + " <Loggers>\n" - + " <Root level=\"${sys_log_level}\" includeLocation=\"${include_location_flag}\">\n" - + " <AppenderRef ref=\"Sys\"/>\n" - + " <AppenderRef ref=\"SysWF\" level=\"WARN\"/>\n" - + " <!--REPLACED BY Console Logger-->\n" - + " </Root>\n" - + " <Logger name=\"audit\" level=\"ERROR\" additivity=\"false\">\n" - + " <AppenderRef ref=\"Auditfile\"/>\n" - + " </Logger>\n" - + " <!--REPLACED BY AUDIT AND VERBOSE MODULE NAMES-->\n" - + " </Loggers>\n" - + "</Configuration>"; - // CHECKSTYLE ON + private static StringBuilder xmlConfTemplateBuilder = new StringBuilder(); + + static { + // CHECKSTYLE OFF + xmlConfTemplateBuilder.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") + .append("\n<!-- Auto Generated. DO NOT MODIFY IT! -->\n") + .append("<Configuration status=\"info\" packages=\"org.apache.doris.common\">\n") + .append(" <Appenders>\n") + .append(" <Console name=\"Console\" target=\"SYSTEM_OUT\">") + .append(" <PatternLayout charset=\"UTF-8\">\n") + .append(" <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n") + .append(" </PatternLayout>\n") + .append(" </Console>") Review Comment: ```suggestion .append(" </Console>\n") ``` -- 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