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 1f9328cdc3e branch-4.0: [fix](cloud) Fix cloud not print ms log #61766 
(#62019)
1f9328cdc3e is described below

commit 1f9328cdc3edae117e8419f3b781700a8643cd6e
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Apr 9 12:14:34 2026 +0800

    branch-4.0: [fix](cloud) Fix cloud not print ms log #61766 (#62019)
    
    Cherry-picked from #61766
    
    Co-authored-by: deardeng <[email protected]>
---
 cloud/script/start.sh |  5 +++--
 cloud/src/main.cpp    | 14 +++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/cloud/script/start.sh b/cloud/script/start.sh
index bdaa1ea1aaa..415d9ea3fb4 100644
--- a/cloud/script/start.sh
+++ b/cloud/script/start.sh
@@ -172,8 +172,9 @@ if [[ "${RUN_DAEMON}" -eq 1 ]]; then
     tail -n12 "${out_file}"
     exit 0
 elif [[ "${RUN_CONSOLE}" -eq 1 ]]; then
-    # stdout and stderr both output to doris_cloud.out
-    "${bin}" "$@" >>"${out_file}" 2>&1
+    # stdout for K8S log capture (StdoutLogSink), stderr (startup info + crash 
stack) to .out file
+    export DORIS_LOG_TO_STDERR=1
+    "${bin}" "$@" 2>>"${out_file}"
 else
     "${bin}" "$@"
 fi
diff --git a/cloud/src/main.cpp b/cloud/src/main.cpp
index fa91d138e15..214b61da394 100644
--- a/cloud/src/main.cpp
+++ b/cloud/src/main.cpp
@@ -76,7 +76,7 @@ std::shared_ptr<int> gen_pidfile(const std::string& 
process_name) {
     }
     pidfile << getpid() << std::endl;
     pidfile.close();
-    std::cout << "pid=" << getpid() << " written to file=" << pid_path << 
std::endl;
+    std::cerr << "pid=" << getpid() << " written to file=" << pid_path << 
std::endl;
     return holder;
 }
 
@@ -230,18 +230,18 @@ int main(int argc, char** argv) {
     std::string msg;
     LOG(INFO) << "try to start " << process_name;
     LOG(INFO) << build_info();
-    std::cout << build_info() << std::endl;
+    std::cerr << build_info() << std::endl;
 
     // Check the local ip before starting the meta service or recycler.
     std::string ip = get_local_ip(config::priority_networks);
-    std::cout << "local ip: " << ip << std::endl;
+    std::cerr << "local ip: " << ip << std::endl;
 
     if (!args.get<bool>(ARG_META_SERVICE) && !args.get<bool>(ARG_RECYCLER)) {
         std::get<0>(args.args()[ARG_META_SERVICE]) = true;
         std::get<0>(args.args()[ARG_RECYCLER]) = true;
         LOG(INFO) << "meta_service and recycler are both not specified, "
                      "run doris_cloud as meta_service and recycler by default";
-        std::cout << "try to start meta_service, recycler" << std::endl;
+        std::cerr << "try to start meta_service, recycler" << std::endl;
     }
 
     google::SetCommandLineOption("bvar_max_dump_multi_dimension_metric_number",
@@ -299,7 +299,7 @@ int main(int argc, char** argv) {
         }
         msg = "MetaService has been started successfully";
         LOG(INFO) << msg;
-        std::cout << msg << std::endl;
+        std::cerr << msg << std::endl;
     }
     if (args.get<bool>(ARG_RECYCLER)) {
         recycler = std::make_unique<Recycler>(txn_kv);
@@ -312,7 +312,7 @@ int main(int argc, char** argv) {
         }
         msg = "Recycler has been started successfully";
         LOG(INFO) << msg;
-        std::cout << msg << std::endl;
+        std::cerr << msg << std::endl;
         auto periodiccally_log = [&]() {
             while (periodiccally_log_thread_run) {
                 std::unique_lock<std::mutex> lck 
{periodiccally_log_thread_lock};
@@ -358,7 +358,7 @@ int main(int argc, char** argv) {
           (internal_port > 0 ? " internal_port=" + 
std::to_string(internal_port) : "");
 
     LOG(INFO) << msg;
-    std::cout << msg << std::endl;
+    std::cerr << msg << std::endl;
 
     server.RunUntilAskedToQuit(); // Wait for signals
     server.ClearServices();


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

Reply via email to