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

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 91f06c9908f [bugfix](k8s) fix fe.out not generated when start_fe.sh 
--console (#61807)
91f06c9908f is described below

commit 91f06c9908f083501ce4e1168289a0e4b446211e
Author: deardeng <[email protected]>
AuthorDate: Fri Mar 27 18:54:42 2026 +0800

    [bugfix](k8s) fix fe.out not generated when start_fe.sh --console (#61807)
    
    pick from https://github.com/apache/doris/pull/60522/changes
    
    When running FE in console mode (start_fe.sh --console), the fe.out log
    file was not generated because stdout/stderr were not redirected to the
    log file.
    
    The root cause is that the log4j console appender was configured with
    target="SYSTEM_OUT", which sends log4j logs to stdout. This makes it
    impossible to separate log4j logs from JVM stdout output at the shell
    level.
    
    Fix:
    1. Change log4j console appender target from SYSTEM_OUT to SYSTEM_ERR in
    Log4jConfig.java, so that log4j logs go to stderr (displayed on
    terminal) instead of stdout. This also matches the env var name
    DORIS_LOG_TO_STDERR.
    2. Redirect stdout to fe.out in start_fe.sh console mode, consistent
    with daemon mode behavior. The fe.out file now only contains JVM native
    output, not log4j formatted logs.
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 bin/start_fe.sh                                                   | 2 +-
 fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/start_fe.sh b/bin/start_fe.sh
index 85f97696f9b..dd36f96a530 100755
--- a/bin/start_fe.sh
+++ b/bin/start_fe.sh
@@ -427,7 +427,7 @@ elif [[ "${RUN_DAEMON}" -eq 1 ]]; then
     nohup ${LIMIT:+${LIMIT}} "${JAVA}" ${final_java_opt:+${final_java_opt}} 
-XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError="kill -9 %p" 
${coverage_opt:+${coverage_opt}} org.apache.doris.DorisFE ${HELPER:+${HELPER}} 
"${METADATA_FAILURE_RECOVERY}" "${RECOVERY_JOURNAL_ID:+${RECOVERY_JOURNAL_ID}}" 
"${CLUSTER_SNAPSHOT}" "$@" >>"${STDOUT_LOGGER}" 2>&1 </dev/null &
 elif [[ "${RUN_CONSOLE}" -eq 1 ]]; then
     export DORIS_LOG_TO_STDERR=1
-    ${LIMIT:+${LIMIT}} "${JAVA}" ${final_java_opt:+${final_java_opt}} 
-XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError="kill -9 %p" 
${coverage_opt:+${coverage_opt}} org.apache.doris.DorisFE ${HELPER:+${HELPER}} 
${OPT_VERSION:+${OPT_VERSION}} "${METADATA_FAILURE_RECOVERY}" 
"${RECOVERY_JOURNAL_ID:+${RECOVERY_JOURNAL_ID}}" "${CLUSTER_SNAPSHOT}" "$@" 
</dev/null
+    ${LIMIT:+${LIMIT}} "${JAVA}" ${final_java_opt:+${final_java_opt}} 
-XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError="kill -9 %p" 
${coverage_opt:+${coverage_opt}} org.apache.doris.DorisFE ${HELPER:+${HELPER}} 
${OPT_VERSION:+${OPT_VERSION}} "${METADATA_FAILURE_RECOVERY}" 
"${RECOVERY_JOURNAL_ID:+${RECOVERY_JOURNAL_ID}}" "${CLUSTER_SNAPSHOT}" "$@" 
>>"${STDOUT_LOGGER}" </dev/null
 else
     ${LIMIT:+${LIMIT}} "${JAVA}" ${final_java_opt:+${final_java_opt}} 
-XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError="kill -9 %p" 
${coverage_opt:+${coverage_opt}} org.apache.doris.DorisFE ${HELPER:+${HELPER}} 
${OPT_VERSION:+${OPT_VERSION}} "${METADATA_FAILURE_RECOVERY}" 
"${RECOVERY_JOURNAL_ID:+${RECOVERY_JOURNAL_ID}}" "${CLUSTER_SNAPSHOT}" "$@" 
>>"${STDOUT_LOGGER}" 2>&1 </dev/null
 fi
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 39d13b0e989..b35e076c07f 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
@@ -93,12 +93,12 @@ public class Log4jConfig extends XmlConfiguration {
             .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=\"" + RUNTIME_LOG_CONSOLE_APPENDER + 
"\" target=\"SYSTEM_OUT\">\n")
+            .append("    <Console name=\"" + RUNTIME_LOG_CONSOLE_APPENDER + 
"\" target=\"SYSTEM_ERR\">\n")
             .append("      <PatternLayout charset=\"UTF-8\">\n")
             .append("        <Pattern>" + RUNTIME_LOG_PATTERN + "</Pattern>\n")
             .append("      </PatternLayout>\n")
             .append("    </Console>\n")
-            .append("    <Console name=\"" + AUDIT_LOG_CONSOLE_APPENDER + "\" 
target=\"SYSTEM_OUT\">\n")
+            .append("    <Console name=\"" + AUDIT_LOG_CONSOLE_APPENDER + "\" 
target=\"SYSTEM_ERR\">\n")
             .append("      <PatternLayout charset=\"UTF-8\">\n")
             .append("        <Pattern>" + AUDIT_LOG_PATTERN + "</Pattern>\n")
             .append("      </PatternLayout>\n")


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

Reply via email to