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

gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 3cdc4823194 [fix](cloud) Fix cloud not print ms log (#61766)
3cdc4823194 is described below

commit 3cdc48231945ca496da19a0612fe6592fb72f539
Author: deardeng <[email protected]>
AuthorDate: Thu Apr 2 01:27:48 2026 +0800

    [fix](cloud) Fix cloud not print ms log (#61766)
    
    due to https://github.com/apache/doris/pull/60490, ms not print ms log in 
k8s
    `start.sh --conf=/opt/apache/doris/ms/conf/doris_cloud.conf --console`
---
 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