From cd205229ce4f956437b38243b39ffa1dda9bc409 Mon Sep 17 00:00:00 2001 From: NaturalSelect <2145973003@qq.com> Date: Thu, 9 Nov 2023 10:02:15 +0800 Subject: [PATCH] fix(util): stop write log to stderr, when FLAGS_logtostderr is false close: #2811 Signed-off-by: NaturalSelect <2145973003@qq.com> --- curvefs/src/client/curve_fuse_op.cpp | 2 ++ curvefs/src/mds/main.cpp | 2 ++ curvefs/src/metaserver/main.cpp | 2 ++ nebd/src/part2/main.cpp | 2 ++ src/chunkserver/chunkserver.cpp | 2 ++ src/mds/main/main.cpp | 2 ++ src/snapshotcloneserver/main.cpp | 2 ++ 7 files changed, 14 insertions(+) diff --git a/curvefs/src/client/curve_fuse_op.cpp b/curvefs/src/client/curve_fuse_op.cpp index dd249c8892..69facca002 100644 --- a/curvefs/src/client/curve_fuse_op.cpp +++ b/curvefs/src/client/curve_fuse_op.cpp @@ -152,6 +152,8 @@ int InitLog(const char *confPath, const char *argv0) { FLAGS_vlog_level = FLAGS_v; // initialize logging module + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv0); bool succ = InitAccessLog(FLAGS_log_dir); diff --git a/curvefs/src/mds/main.cpp b/curvefs/src/mds/main.cpp index 725c29e89c..6e63b6c57c 100644 --- a/curvefs/src/mds/main.cpp +++ b/curvefs/src/mds/main.cpp @@ -64,6 +64,8 @@ int main(int argc, char **argv) { } // initialize logging module + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); conf->PrintConfig(); diff --git a/curvefs/src/metaserver/main.cpp b/curvefs/src/metaserver/main.cpp index ec390ab951..d6ddae1e42 100644 --- a/curvefs/src/metaserver/main.cpp +++ b/curvefs/src/metaserver/main.cpp @@ -126,6 +126,8 @@ int main(int argc, char **argv) { FLAGS_vlog_level = FLAGS_v; // initialize logging module + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); conf->PrintConfig(); diff --git a/nebd/src/part2/main.cpp b/nebd/src/part2/main.cpp index f8c742fe9a..f9def844b5 100644 --- a/nebd/src/part2/main.cpp +++ b/nebd/src/part2/main.cpp @@ -30,6 +30,8 @@ DEFINE_string(confPath, "/etc/nebd/nebd-server.conf", "nebd server conf path"); int main(int argc, char* argv[]) { // 解析参数 google::ParseCommandLineFlags(&argc, &argv, false); + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); std::string confPath = FLAGS_confPath.c_str(); diff --git a/src/chunkserver/chunkserver.cpp b/src/chunkserver/chunkserver.cpp index bf5e711fa9..e8e8838a45 100644 --- a/src/chunkserver/chunkserver.cpp +++ b/src/chunkserver/chunkserver.cpp @@ -105,6 +105,8 @@ int ChunkServer::Run(int argc, char** argv) { LoadConfigFromCmdline(&conf); // 初始化日志模块 + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); // 打印参数 diff --git a/src/mds/main/main.cpp b/src/mds/main/main.cpp index c0824f3bca..b1361f0ae4 100644 --- a/src/mds/main/main.cpp +++ b/src/mds/main/main.cpp @@ -107,6 +107,8 @@ int main(int argc, char **argv) { } // initialize logging module + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); // reset SIGPIPE handler diff --git a/src/snapshotcloneserver/main.cpp b/src/snapshotcloneserver/main.cpp index b44468b857..2e8592ca15 100644 --- a/src/snapshotcloneserver/main.cpp +++ b/src/snapshotcloneserver/main.cpp @@ -80,6 +80,8 @@ int main(int argc, char **argv) { LoadConfigFromCmdline(conf.get()); conf->PrintConfig(); conf->ExposeMetric("snapshot_clone_server_config"); + // NOTE: https://github.com/google/glog#setting-flags + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); snapshotcloneserver_main(conf); }