Skip to content

Commit

Permalink
fix(util): stop write log to stderr, when FLAGS_logtostderr is false
Browse files Browse the repository at this point in the history
Signed-off-by: NaturalSelect <[email protected]>
  • Loading branch information
NaturalSelect committed Nov 7, 2023
1 parent 09d2f02 commit dd58873
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 48 deletions.
5 changes: 2 additions & 3 deletions curvefs/src/mds/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include "curvefs/src/mds/mds.h"
#include "src/common/configuration.h"
#include "src/common/log_util.h"
#include "curvefs/src/common/dynamic_vlog.h"

using ::curve::common::Configuration;
Expand Down Expand Up @@ -65,8 +64,8 @@ int main(int argc, char **argv) {
}

// initialize logging module
FLAGS_logtostderr = false;
curve::common::InitGoogleLogging(argv[0]);
FLAGS_stderrthreshold = 3;
google::InitGoogleLogging(argv[0]);

conf->PrintConfig();

Expand Down
4 changes: 2 additions & 2 deletions src/chunkserver/chunkserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ int ChunkServer::Run(int argc, char** argv) {
LoadConfigFromCmdline(&conf);

// 初始化日志模块
FLAGS_logtostderr = false;
curve::common::InitGoogleLogging(argv[0]);
FLAGS_stderrthreshold = 3;
google::InitGoogleLogging(argv[0]);

// 打印参数
conf.PrintConfig();
Expand Down
27 changes: 0 additions & 27 deletions src/common/log_util.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions src/common/log_util.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/mds/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ int main(int argc, char **argv) {
}

// initialize logging module
FLAGS_logtostderr = false;
curve::common::InitGoogleLogging(argv[0]);
FLAGS_stderrthreshold = 3;
google::InitGoogleLogging(argv[0]);

// reset SIGPIPE handler
// etcdclient register SIGPIPE handler in its initialization progress, which
Expand Down
5 changes: 2 additions & 3 deletions src/snapshotcloneserver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <glog/logging.h>
#include <gflags/gflags.h>
#include "src/snapshotcloneserver/snapshotclone_server.h"
#include "src/common/log_util.h"

DEFINE_string(conf, "conf/snapshot_clone_server.conf", "snapshot&clone server config file path"); //NOLINT
DEFINE_string(addr, "127.0.0.1:5555", "snapshotcloneserver address");
Expand Down Expand Up @@ -81,8 +80,8 @@ int main(int argc, char **argv) {
LoadConfigFromCmdline(conf.get());
conf->PrintConfig();
conf->ExposeMetric("snapshot_clone_server_config");
FLAGS_logtostderr = false;
curve::common::InitGoogleLogging(argv[0]);
FLAGS_stderrthreshold = 3;
google::InitGoogleLogging(argv[0]);
snapshotcloneserver_main(conf);
}

0 comments on commit dd58873

Please sign in to comment.