Skip to content

Commit

Permalink
curvefs/mds: add log level
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanHai committed Jun 9, 2022
1 parent 7f08b0c commit d88745e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions curvefs/conf/mds.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ mds.listen.addr=127.0.0.1:6700 #__CURVEADM_TEMPLATE__ ${service_addr}:${service
# dummy server port
mds.dummy.port=7700 # __CURVEADM_TEMPLATE__ ${service_dummy_port} __CURVEADM_TEMPLATE__ __ANSIBLE_TEMPLATE__ {{ curvefs_mds_listen_dummy_port }} __ANSIBLE_TEMPLATE__
mds.common.logDir=/tmp/curvefs/mds # __CURVEADM_TEMPLATE__ ${prefix}/logs __CURVEADM_TEMPLATE__ __ANSIBLE_TEMPLATE__ /tmp/{{ inventory_hostname }}/curvefs/mds __ANSIBLE_TEMPLATE__
mds.loglevel=0

#
# space options
#
Expand Down
1 change: 1 addition & 0 deletions curvefs/src/mds/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ cc_library(
"//curvefs/src/mds/schedule:curvefs_schedule",
"//curvefs/src/mds/schedule/scheduleService:curvefs_schedule_service",
"//src/common:curve_s3_adapter",
"//curvefs/src/common:dynamic_vlog",
],
)

Expand Down
12 changes: 10 additions & 2 deletions curvefs/src/mds/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

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

using ::curve::common::Configuration;
using ::curvefs::common::FLAGS_vlog_level;

DEFINE_string(confPath, "curvefs/conf/mds.conf", "mds confPath");
DEFINE_string(mdsAddr, "127.0.0.1:6700", "mds listen addr");
Expand All @@ -36,6 +38,10 @@ void LoadConfigFromCmdline(Configuration *conf) {
if (GetCommandLineFlagInfo("mdsAddr", &info) && !info.is_default) {
conf->SetStringValue("mds.listen.addr", FLAGS_mdsAddr);
}

if (GetCommandLineFlagInfo("v", &info) && !info.is_default) {
conf->SetIntValue("mds.loglevel", FLAGS_v);
}
}

int main(int argc, char **argv) {
Expand All @@ -47,7 +53,9 @@ int main(int argc, char **argv) {
conf->SetConfigPath(confPath);
LOG_IF(FATAL, !conf->LoadConfig())
<< "load mds configuration fail, conf path = " << confPath;
conf->GetValueFatalIfFail("mds.loglevel", &FLAGS_v);
LoadConfigFromCmdline(conf.get());
FLAGS_vlog_level = FLAGS_v;
conf->PrintConfig();
if (FLAGS_log_dir.empty()) {
if (!conf->GetStringValue("mds.common.logDir", &FLAGS_log_dir)) {
Expand All @@ -56,11 +64,11 @@ int main(int argc, char **argv) {
}
}

curvefs::mds::MDS mds;

// initialize logging module
google::InitGoogleLogging(argv[0]);

curvefs::mds::MDS mds;

// initialize MDS options
mds.InitOptions(conf);

Expand Down

0 comments on commit d88745e

Please sign in to comment.