summaryrefslogtreecommitdiff
path: root/src/mongo/db/server_options_helpers.cpp
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@mongodb.com>2014-04-01 12:01:36 -0400
committerShaun Verch <shaun.verch@mongodb.com>2014-04-01 16:23:14 -0400
commit9d2e260f329696f22a75717510b106ea8c34c1f5 (patch)
tree3a2cbc6094feafbbbc3465b3e3b4a7b61d8bedca /src/mongo/db/server_options_helpers.cpp
parentf4e6aa9ee7c0dccbb4789d3dff1d92b086d67b88 (diff)
downloadmongo-9d2e260f329696f22a75717510b106ea8c34c1f5.tar.gz
SERVER-13438 Handle syslog case of systemLog.destination properly
Diffstat (limited to 'src/mongo/db/server_options_helpers.cpp')
-rw-r--r--src/mongo/db/server_options_helpers.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index da02c8064d3..8ef2f45eb9b 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -165,7 +165,7 @@ namespace {
options->addOptionChaining("logpath", "logpath", moe::String,
"log file to send write to instead of stdout - has to be a file, not directory")
.setSources(moe::SourceAllLegacy)
- .incompatibleWith("systemLog.syslog");
+ .incompatibleWith("syslog");
options->addOptionChaining("systemLog.path", "", moe::String,
"log file to send writes to if logging to a file - has to be a file, not directory")
@@ -176,11 +176,10 @@ namespace {
"Destination of system log output. (syslog/file)")
.setSources(moe::SourceYAMLConfig)
.hidden()
- .requires("systemLog.path")
.format("(:?syslog)|(:?file)", "(syslog/file)");
#ifndef _WIN32
- options->addOptionChaining("systemLog.syslog", "syslog", moe::Switch,
+ options->addOptionChaining("syslog", "syslog", moe::Switch,
"log to system's syslog facility instead of file or stdout")
.incompatibleWith("systemLog.logpath")
.setSources(moe::SourceAllLegacy);
@@ -522,6 +521,19 @@ namespace {
}
}
+ // "systemLog.destination" comes from the config file, so override it if "syslog" is set
+ // since that comes from the command line.
+ if (params->count("syslog")) {
+ Status ret = params->set("systemLog.destination", moe::Value(std::string("syslog")));
+ if (!ret.isOK()) {
+ return ret;
+ }
+ ret = params->remove("syslog");
+ if (!ret.isOK()) {
+ return ret;
+ }
+ }
+
return Status::OK();
}
@@ -691,7 +703,7 @@ namespace {
"Can only use systemLog.path if systemLog.destination is to a "
"file");
}
- // syslog facility is set independently of these options
+ serverGlobalParams.logWithSyslog = true;
}
else {
StringBuilder sb;
@@ -708,8 +720,6 @@ namespace {
}
- serverGlobalParams.logWithSyslog = params.count("systemLog.syslog");
-
#ifndef _WIN32
if (params.count("systemLog.syslogFacility")) {
std::string facility = params["systemLog.syslogFacility"].as<string>();