Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
morningman committed Mar 27, 2024
1 parent efa44ae commit 44d0f26
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ public class Config extends ConfigBase {
* sys_log_enable_compress:
* default is false. if true, will compress fe.log & fe.warn.log by gzip
*/
@Deprecated // use env var LOG_DIR instead
@ConfField(description = {"FE 日志文件的存放路径,用于存放 fe.log。",
"The path of the FE log file, used to store fe.log"})
public static String sys_log_dir = System.getenv("DORIS_HOME") + "/log";
public static String sys_log_dir = "";

@ConfField(description = {"FE 日志的级别", "The level of FE log"}, options = {"INFO", "WARN", "ERROR", "FATAL"})
public static String sys_log_level = "INFO";
Expand Down Expand Up @@ -101,7 +102,7 @@ public class Config extends ConfigBase {

@ConfField(description = {"FE 审计日志文件的存放路径,用于存放 fe.audit.log。",
"The path of the FE audit log file, used to store fe.audit.log"})
public static String audit_log_dir = System.getenv("DORIS_HOME") + "/log";
public static String audit_log_dir = System.getenv("LOG_DIR");
@ConfField(description = {"FE 审计日志文件的最大数量。超过这个数量后,最老的日志文件会被删除",
"The maximum number of FE audit log files. "
+ "After exceeding this number, the oldest log file will be deleted"})
Expand Down Expand Up @@ -570,7 +571,7 @@ public class Config extends ConfigBase {
public static String spark_resource_path = "";

@ConfField(description = {"Spark launcher 日志路径", "Spark launcher log dir"})
public static String spark_launcher_log_dir = sys_log_dir + "/spark_launcher_log";
public static String spark_launcher_log_dir = System.getenv("LOG_DIR") + "/spark_launcher_log";

@ConfField(description = {"Yarn client 的路径", "Yarn client path"})
public static String yarn_client_path = System.getenv("DORIS_HOME") + "/lib/yarn-client/hadoop/bin/yarn";
Expand Down Expand Up @@ -2463,7 +2464,7 @@ public class Config extends ConfigBase {

@ConfField(description = {"nereids trace文件的存放路径。",
"The path of the nereids trace file."})
public static String nereids_trace_log_dir = System.getenv("DORIS_HOME") + "/log/nereids_trace";
public static String nereids_trace_log_dir = System.getenv("LOG_DIR") + "/nereids_trace";

@ConfField(mutable = true, masterOnly = true, description = {
"备份过程中,分配给每个be的upload任务最大个数,默认值为3个。",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static Df df(String dir) {
return df;
}


Process process;
try {
process = Runtime.getRuntime().exec("df -k " + dir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.doris.httpv2.config.SpringLog4j2Config;

import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
Expand Down Expand Up @@ -136,7 +137,9 @@ private static void reconfig() throws IOException {
String newXmlConfTemplate = xmlConfTemplate;

// sys log config
String sysLogDir = Config.sys_log_dir;
// ATTN, sys_log_dir is deprecated, use LOG_DIR instead
String sysLogDir = Strings.isNullOrEmpty(Config.sys_log_dir) ? System.getenv("LOG_DIR") :
Config.sys_log_dir;
String sysRollNum = String.valueOf(Config.sys_log_roll_num);
String sysDeleteAge = String.valueOf(Config.sys_log_delete_age);
boolean compressSysLog = Config.sys_log_enable_compress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ private void appendLogConf(Map<String, Map<String, String>> content, String addV
private void appendLogInfo(Map<String, Map<String, String>> content) {
Map<String, String> map = new HashMap<>();

final String logPath = Config.sys_log_dir + "/fe.warn.log";
String logDir = Strings.isNullOrEmpty(Config.sys_log_dir) ? System.getenv("LOG_DIR") : Config.sys_log_dir;
final String logPath = logDir + "/fe.warn.log";
map.put("logPath", logPath);

RandomAccessFile raf = null;
Expand Down
16 changes: 10 additions & 6 deletions fe/fe-core/src/main/java/org/apache/doris/service/ExecuteEnv.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.apache.doris.qe.ConnectScheduler;
import org.apache.doris.qe.MultiLoadMgr;

import com.google.common.base.Strings;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -40,13 +42,15 @@ private ExecuteEnv() {
scheduler = new ConnectScheduler(Config.qe_max_connection);
startupTime = System.currentTimeMillis();
processUUID = System.currentTimeMillis();
String logDir = Strings.isNullOrEmpty(Config.sys_log_dir) ? System.getenv("LOG_DIR") :
Config.sys_log_dir;
diskInfos = new ArrayList<FeDiskInfo>() {{
add(new FeDiskInfo("meta", Config.meta_dir, DiskUtils.df(Config.meta_dir)));
add(new FeDiskInfo("log", Config.sys_log_dir, DiskUtils.df(Config.sys_log_dir)));
add(new FeDiskInfo("audit-log", Config.audit_log_dir, DiskUtils.df(Config.audit_log_dir)));
add(new FeDiskInfo("temp", Config.tmp_dir, DiskUtils.df(Config.tmp_dir)));
add(new FeDiskInfo("deploy", System.getenv("DORIS_HOME"), DiskUtils.df(System.getenv("DORIS_HOME"))));
}};
add(new FeDiskInfo("meta", Config.meta_dir, DiskUtils.df(Config.meta_dir)));
add(new FeDiskInfo("log", logDir, DiskUtils.df(logDir)));
add(new FeDiskInfo("audit-log", Config.audit_log_dir, DiskUtils.df(Config.audit_log_dir)));
add(new FeDiskInfo("temp", Config.tmp_dir, DiskUtils.df(Config.tmp_dir)));
add(new FeDiskInfo("deploy", System.getenv("DORIS_HOME"), DiskUtils.df(System.getenv("DORIS_HOME"))));
}};
}

public static ExecuteEnv getInstance() {
Expand Down

0 comments on commit 44d0f26

Please sign in to comment.