summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmirsaman Memaripour <amirsaman.memaripour@mongodb.com>2020-03-26 10:45:50 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 05:03:52 +0000
commitbc67d9be07b35da807ae854960e24f9ed61e5d43 (patch)
treec72fb86eefad808b0f641c06b40326799f8a2924
parent019afd89c77629a3cabf93803314dd77f451276b (diff)
downloadmongo-bc67d9be07b35da807ae854960e24f9ed61e5d43.tar.gz
SERVER-47077 Clean up log lines in 'mongo/db'
Cleaning up log lines to adhere to the LOGV2 style guide.
-rw-r--r--src/mongo/db/commands.cpp46
-rw-r--r--src/mongo/db/initialize_server_global_state.cpp15
-rw-r--r--src/mongo/db/log_process_details.cpp4
-rw-r--r--src/mongo/db/mongod_options.cpp10
-rw-r--r--src/mongo/db/operation_killer.cpp2
5 files changed, 41 insertions, 36 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index 57b65cca648..3085027db40 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -614,9 +614,9 @@ void CommandHelpers::evaluateFailCommandFailPoint(OperationContext* opCtx,
if (closeConnection) {
opCtx->getClient()->session()->end();
LOGV2(20431,
- "Failing command '{cmd_getName}' via 'failCommand' failpoint. Action: "
- "closing connection.",
- "cmd_getName"_attr = cmd->getName());
+ "Failing {command} via 'failCommand' failpoint: closing connection",
+ "Failing command via 'failCommand' failpoint: closing connection",
+ "command"_attr = cmd->getName());
uasserted(50985, "Failing command due to 'failCommand' failpoint");
}
@@ -631,32 +631,35 @@ void CommandHelpers::evaluateFailCommandFailPoint(OperationContext* opCtx,
blockTimeMS >= 0);
LOGV2(20432,
- "Blocking command '{cmd_getName}' via 'failCommand' failpoint for "
- "{blockTimeMS} milliseconds",
- "cmd_getName"_attr = cmd->getName(),
- "blockTimeMS"_attr = blockTimeMS);
+ "Blocking {command} via 'failCommand' failpoint for {blockTime}",
+ "Blocking command via 'failCommand' failpoint",
+ "command"_attr = cmd->getName(),
+ "blockTime"_attr = Milliseconds{blockTimeMS});
opCtx->sleepFor(Milliseconds{blockTimeMS});
LOGV2(20433,
- "Unblocking command '{cmd_getName}' via 'failCommand' failpoint",
- "cmd_getName"_attr = cmd->getName());
+ "Unblocking {command} via 'failCommand' failpoint",
+ "Unblocking command via 'failCommand' failpoint",
+ "command"_attr = cmd->getName());
}
if (hasExtraInfo) {
LOGV2(20434,
- "Failing command '{cmd_getName}' via 'failCommand' failpoint. Action: "
- "returning error code {errorCode} and {errorExtraInfo}.",
- "cmd_getName"_attr = cmd->getName(),
+ "Failing {command} via 'failCommand' failpoint: returning {errorCode} and "
+ "{errorExtraInfo}",
+ "Failing command via 'failCommand' failpoint",
+ "command"_attr = cmd->getName(),
"errorCode"_attr = errorCode,
"errorExtraInfo"_attr = errorExtraInfo);
uassertStatusOK(Status(ErrorCodes::Error(errorCode),
"Failing command due to 'failCommand' failpoint",
errorExtraInfo.Obj()));
} else if (hasErrorCode) {
- LOGV2(20435,
- "Failing command '{cmd_getName}' via 'failCommand' failpoint. Action: "
- "returning error code {errorCode}.",
- "cmd_getName"_attr = cmd->getName(),
- "errorCode"_attr = errorCode);
+ LOGV2(
+ 20435,
+ "Failing command {command} via 'failCommand' failpoint: returning {errorCode}",
+ "Failing command via 'failCommand' failpoint",
+ "command"_attr = cmd->getName(),
+ "errorCode"_attr = errorCode);
uasserted(ErrorCodes::Error(errorCode),
"Failing command due to 'failCommand' failpoint");
}
@@ -741,10 +744,11 @@ void CommandInvocation::checkAuthorization(OperationContext* opCtx,
}
}
} catch (const DBException& e) {
- LOGV2_OPTIONS(20436,
- {logComponentV1toV2(LogComponent::kAccessControl)},
- "{e_toStatus}",
- "e_toStatus"_attr = e.toStatus());
+ LOGV2_ERROR_OPTIONS(20436,
+ {logComponentV1toV2(LogComponent::kAccessControl)},
+ "Checking authorization failed: {error}",
+ "Checking authorization failed",
+ "error"_attr = e.toStatus());
CommandHelpers::auditLogAuthEvent(opCtx, this, request, e.code());
throw;
}
diff --git a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp
index 9fb791ecc30..dbcfb3623f8 100644
--- a/src/mongo/db/initialize_server_global_state.cpp
+++ b/src/mongo/db/initialize_server_global_state.cpp
@@ -111,7 +111,7 @@ void signalForkSuccess() {
if (close(*f) == -1) {
int savedErr = errno;
LOGV2_WARNING(4656301,
- "closing write pipe failed",
+ "Closing write pipe failed",
"errno"_attr = savedErr,
"errnoDesc"_attr = errnoWithDescription(savedErr));
}
@@ -378,9 +378,10 @@ MONGO_INITIALIZER_GENERAL(ServerLogRedirection,
boost::filesystem::rename(absoluteLogpath, renameTarget, ec);
if (!ec) {
LOGV2(20697,
- "log file \"{absoluteLogpath}\" exists; moved to \"{renameTarget}\".",
- "absoluteLogpath"_attr = absoluteLogpath,
- "renameTarget"_attr = renameTarget);
+ "Moving existing log file \"{oldLogPath}\" to \"{newLogPath}\"",
+ "Renamed existing log file",
+ "oldLogPath"_attr = absoluteLogpath,
+ "newLogPath"_attr = renameTarget);
} else {
return Status(ErrorCodes::FileRenameFailed,
str::stream()
@@ -427,7 +428,8 @@ MONGO_INITIALIZER_GENERAL(ServerLogRedirection,
javascriptAppender = std::make_unique<RotatableFileAppender<MessageEventEphemeral>>(
std::make_unique<MessageEventDetailsEncoder>(), writer.getValue());
if (serverGlobalParams.logAppend && exists) {
- LOGV2(20699, "***** SERVER RESTARTED *****");
+ LOGV2_WARNING_OPTIONS(
+ 20699, {logv2::LogTag::kStartupWarnings}, "***** SERVER RESTARTED *****");
Status status = logger::RotatableFileWriter::Use(writer.getValue()).status();
if (!status.isOK())
return status;
@@ -464,7 +466,8 @@ MONGO_INITIALIZER_GENERAL(ServerLogRedirection,
lv2Config.timestampFormat = serverGlobalParams.logTimestampFormat;
Status result = lv2Manager.getGlobalDomainInternal().configure(lv2Config);
if (result.isOK() && writeServerRestartedAfterLogConfig)
- LOGV2(20698, "***** SERVER RESTARTED *****");
+ LOGV2_WARNING_OPTIONS(
+ 20698, {logv2::LogTag::kStartupWarnings}, "***** SERVER RESTARTED *****");
return result;
}
diff --git a/src/mongo/db/log_process_details.cpp b/src/mongo/db/log_process_details.cpp
index f63401df6fd..744c478d6ca 100644
--- a/src/mongo/db/log_process_details.cpp
+++ b/src/mongo/db/log_process_details.cpp
@@ -95,11 +95,11 @@ void logProcessDetailsForLogRotate(ServiceContext* serviceContext) {
if (rsConfig.isInitialized()) {
LOGV2(20722,
- "Replica Set Config",
+ "Node is a member of a replica set",
"config"_attr = rsConfig,
"memberState"_attr = replCoord->getMemberState());
} else {
- LOGV2(20724, "Node currently has no Replica Set Config.");
+ LOGV2(20724, "Node currently has no replica set config");
}
}
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 5087f08864a..e0d4cf05cd5 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -568,11 +568,9 @@ Status storeMongodOptions(const moe::Environment& params) {
if (params.count("replication.enableMajorityReadConcern") &&
!params["replication.enableMajorityReadConcern"].as<bool>()) {
- LOGV2_WARNING(
- 20879,
- "Config servers require majority read concern, but it was explicitly "
- "disabled. The override is being ignored and the process is continuing "
- "with majority read concern enabled.");
+ LOGV2_WARNING(20879,
+ "Ignoring read concern override as config server requires majority "
+ "read concern");
}
serverGlobalParams.enableMajorityReadConcern = true;
@@ -630,7 +628,7 @@ Status storeMongodOptions(const moe::Environment& params) {
LOGV2(20877, "");
LOGV2_WARNING(20880,
"32-bit servers don't have journaling enabled by default. Please use "
- "--journal if you want durability.");
+ "--journal if you want durability");
LOGV2(20878, "");
}
diff --git a/src/mongo/db/operation_killer.cpp b/src/mongo/db/operation_killer.cpp
index 971b789e806..0cfa250504a 100644
--- a/src/mongo/db/operation_killer.cpp
+++ b/src/mongo/db/operation_killer.cpp
@@ -82,7 +82,7 @@ void OperationKiller::killOperation(OperationId opId) {
serviceContext->killOperation(target, target->getOperationContext());
- LOGV2(20884, "Killed operation: {opId}", "opId"_attr = opId);
+ LOGV2(20884, "Killed operation: {opId}", "Killed operation", "opId"_attr = opId);
}
void OperationKiller::killOperation(const OperationKey& opKey) {