From 93dd6ec7e49bdace6020d895ed890a3a238655fe Mon Sep 17 00:00:00 2001 From: NaturalSelect <2145973003@qq.com> Date: Mon, 6 Nov 2023 17:39:51 +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 | 1 + curvefs/src/mds/main.cpp | 1 + curvefs/src/metaserver/main.cpp | 1 + nebd/src/part2/main.cpp | 1 + src/chunkserver/chunkserver.cpp | 1 + src/mds/main/main.cpp | 1 + src/snapshotcloneserver/main.cpp | 1 + 7 files changed, 7 insertions(+) diff --git a/curvefs/src/client/curve_fuse_op.cpp b/curvefs/src/client/curve_fuse_op.cpp index dd249c8892..31a484dc1d 100644 --- a/curvefs/src/client/curve_fuse_op.cpp +++ b/curvefs/src/client/curve_fuse_op.cpp @@ -152,6 +152,7 @@ int InitLog(const char *confPath, const char *argv0) { FLAGS_vlog_level = FLAGS_v; // initialize logging module + 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..259d4c2f91 100644 --- a/curvefs/src/mds/main.cpp +++ b/curvefs/src/mds/main.cpp @@ -64,6 +64,7 @@ int main(int argc, char **argv) { } // initialize logging module + 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..bac358ff69 100644 --- a/curvefs/src/metaserver/main.cpp +++ b/curvefs/src/metaserver/main.cpp @@ -126,6 +126,7 @@ int main(int argc, char **argv) { FLAGS_vlog_level = FLAGS_v; // initialize logging module + 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..2f892e13a4 100644 --- a/nebd/src/part2/main.cpp +++ b/nebd/src/part2/main.cpp @@ -30,6 +30,7 @@ DEFINE_string(confPath, "/etc/nebd/nebd-server.conf", "nebd server conf path"); int main(int argc, char* argv[]) { // 解析参数 google::ParseCommandLineFlags(&argc, &argv, false); + 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 784628447f..ed8b5f3448 100644 --- a/src/chunkserver/chunkserver.cpp +++ b/src/chunkserver/chunkserver.cpp @@ -105,6 +105,7 @@ int ChunkServer::Run(int argc, char** argv) { LoadConfigFromCmdline(&conf); // 初始化日志模块 + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); // 打印参数 diff --git a/src/mds/main/main.cpp b/src/mds/main/main.cpp index c0824f3bca..d8ffc9654a 100644 --- a/src/mds/main/main.cpp +++ b/src/mds/main/main.cpp @@ -107,6 +107,7 @@ int main(int argc, char **argv) { } // initialize logging module + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); // reset SIGPIPE handler diff --git a/src/snapshotcloneserver/main.cpp b/src/snapshotcloneserver/main.cpp index b44468b857..fb70134bb4 100644 --- a/src/snapshotcloneserver/main.cpp +++ b/src/snapshotcloneserver/main.cpp @@ -80,6 +80,7 @@ int main(int argc, char **argv) { LoadConfigFromCmdline(conf.get()); conf->PrintConfig(); conf->ExposeMetric("snapshot_clone_server_config"); + FLAGS_stderrthreshold = 3; google::InitGoogleLogging(argv[0]); snapshotcloneserver_main(conf); }