Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace doris {

// ErrorName, ErrorCode, String Description, Should print stacktrace
#define APPLY_FOR_ERROR_CODES(M) \
M(OLAP_SUCCESS, 0, "", true) \
M(OLAP_SUCCESS, 0, "", false) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't need to print stack trace for OLAP_SUCCESS

M(OLAP_ERR_OTHER_ERROR, -1, "", true) \
M(OLAP_REQUEST_FAILED, -2, "", true) \
M(OLAP_ERR_OS_ERROR, -100, "", true) \
Expand Down
1 change: 1 addition & 0 deletions bin/start_fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ if [ ${IMAGE_TOOL} -eq 1 ]; then
elif [ ${RUN_DAEMON} -eq 1 ]; then
nohup $LIMIT $JAVA $final_java_opt org.apache.doris.PaloFe ${HELPER} "$@" >> $LOG_DIR/fe.out 2>&1 < /dev/null &
else
export DORIS_LOG_TO_STDERR=1
$LIMIT $JAVA $final_java_opt org.apache.doris.PaloFe ${HELPER} "$@" < /dev/null
fi

Expand Down
3 changes: 3 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/PaloFe.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public static void main(String[] args) {

// entrance for doris frontend
public static void start(String dorisHomeDir, String pidDir, String[] args) {
if (System.getenv("DORIS_LOG_TO_STDERR") != null) {
Log4jConfig.foreground = true;
}
if (Strings.isNullOrEmpty(dorisHomeDir)) {
System.err.println("env DORIS_HOME is not set.");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class Log4jConfig extends XmlConfiguration {
" <Root level=\"${sys_log_level}\">\n" +
" <AppenderRef ref=\"Sys\"/>\n" +
" <AppenderRef ref=\"SysWF\" level=\"WARN\"/>\n" +
" <AppenderRef ref=\"Console\"/>\n" +
" <!--REPLACED BY Console Logger-->\n" +
" </Root>\n" +
" <Logger name=\"audit\" level=\"ERROR\" additivity=\"false\">\n" +
" <AppenderRef ref=\"Auditfile\"/>\n" +
Expand All @@ -116,6 +116,12 @@ public class Log4jConfig extends XmlConfiguration {
public static String confDir;
// custom conf dir
public static String customConfDir;
// Doris uses both system.out and log4j to print log messages.
// This variable is used to check whether to add console appender to loggers.
// If doris is running under daemon mode, then this variable == false, and console logger will not be added.
// If doris is not running under daemon mode, then this variable == true, and console logger will be added to
// loggers, all logs will be printed to console.
public static boolean foreground = false;

private static void reconfig() throws IOException {
String newXmlConfTemplate = xmlConfTemplate;
Expand Down Expand Up @@ -167,6 +173,12 @@ private static void reconfig() throws IOException {
newXmlConfTemplate = newXmlConfTemplate.replaceAll("<!--REPLACED BY AUDIT AND VERBOSE MODULE NAMES-->",
sb.toString());

if (foreground) {
StringBuilder consoleLogger = new StringBuilder();
consoleLogger.append("<AppenderRef ref=\"Console\"/>\n");
newXmlConfTemplate = newXmlConfTemplate.replaceAll("<!--REPLACED BY Console Logger-->",
consoleLogger.toString());
}
Map<String, String> properties = Maps.newHashMap();
properties.put("sys_log_dir", sysLogDir);
properties.put("sys_file_pattern", sysLogRollPattern);
Expand Down