Skip to content

Commit

Permalink
change log4j config
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
  • Loading branch information
murphyatwork committed Jan 15, 2025
1 parent afc469f commit 184154e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
12 changes: 12 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2479,8 +2479,20 @@ public class Config extends ConfigBase {
@ConfField(mutable = true)
public static boolean enable_collect_query_detail_info = false;

//============================== Plan Feature Extraction BEGIN ========================================//
@ConfField(mutable = true, comment = "Collect features of query plan into a log file")
public static boolean enable_plan_feature_collection = false;
@ConfField
public static String feature_log_dir = StarRocksFE.STARROCKS_HOME_DIR + "/log";
@ConfField
public static String feature_log_roll_interval = "DAY";
@ConfField
public static String feature_log_delete_age = "3d";
@ConfField
public static int feature_log_roll_num = 5;
@ConfField
public static int feature_log_roll_size_mb = 1024; // 1 GB in MB
//============================== Plan Feature Extraction END ========================================//

@ConfField(mutable = true,
comment = "Enable the sql digest feature, building a parameterized digest for each sql in the query detail")
Expand Down
18 changes: 13 additions & 5 deletions fe/fe-core/src/main/java/com/starrocks/common/Log4jConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ public class Log4jConfig extends XmlConfiguration {
" </RollingFile>\n" +

" <RollingFile name=\"FeaturesFile\" fileName=\"${profile_log_dir}/fe.features.log\" " +
"filePattern=\"${profile_log_dir}/fe.features.log.${profile_file_pattern}-%i\">\n" +
" filePattern=\"${profile_log_dir}/fe.features.log.${feature_file_pattern}-%i\">\n" +
" ${syslog_profile_layout}\n" +
" <Policies>\n" +
" <TimeBasedTriggeringPolicy/>\n" +
" <SizeBasedTriggeringPolicy size=\"${profile_log_roll_size_mb}MB\"/>\n" +
" <SizeBasedTriggeringPolicy size=\"${feature_log_roll_size_mb}MB\"/>\n" +
" </Policies>\n" +
" <DefaultRolloverStrategy max=\"${profile_log_roll_num}\" fileIndex=\"min\">\n" +
" <Delete basePath=\"${profile_log_dir}/\" maxDepth=\"1\" followLinks=\"true\">\n" +
" <DefaultRolloverStrategy max=\"${feature_log_roll_num}\" fileIndex=\"min\">\n" +
" <Delete basePath=\"${feature_log_dir}/\" maxDepth=\"1\" followLinks=\"true\">\n" +
" <IfFileName glob=\"fe.features.log.*\" />\n" +
" <IfLastModified age=\"${profile_log_delete_age}\" />\n" +
" <IfLastModified age=\"${feature_log_delete_age}\" />\n" +
" </Delete>\n" +
" </DefaultRolloverStrategy>\n" +
" </RollingFile>\n" +
Expand Down Expand Up @@ -272,6 +272,14 @@ static String generateActiveLog4jXmlConfig() throws IOException {
properties.put("profile_file_pattern",
getIntervalPattern("profile_log_roll_interval", Config.profile_log_roll_interval));

// feature log config
properties.put("feature_log_dir", Config.feature_log_dir);
properties.put("feature_log_roll_size_mb", String.valueOf(Config.feature_log_roll_size_mb));
properties.put("feature_log_roll_num", String.valueOf(Config.feature_log_roll_num));
properties.put("feature_log_delete_age", String.valueOf(Config.feature_log_delete_age));
properties.put("feature_file_pattern",
getIntervalPattern("feature_log_roll_interval", Config.feature_log_roll_interval));

// internal log config
properties.put("internal_log_dir", Config.internal_log_dir);
properties.put("internal_roll_maxsize", String.valueOf(Config.log_roll_size_mb));
Expand Down

0 comments on commit 184154e

Please sign in to comment.