summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2020-06-05 15:51:51 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-17 16:21:44 +0000
commitcfa9f090c287c4644a22bbee143cdc570b43402c (patch)
tree9a92df7910fa4d8fa5b2778960a54da8d145de99
parent8f4ebc760ca191898c5405493b2663eaa125c57a (diff)
downloadmongo-cfa9f090c287c4644a22bbee143cdc570b43402c.tar.gz
SERVER-48352 logv2 cleanup for scripting/mozjs, shell/
o also, deduplicated the example log id's in src/mongo/logv2/README.md even though they were just examples, it was funny that there were not unique
-rw-r--r--src/mongo/logv2/README.md18
-rw-r--r--src/mongo/scripting/mozjs/cursor_handle.cpp1
-rw-r--r--src/mongo/scripting/mozjs/engine.cpp44
-rw-r--r--src/mongo/scripting/mozjs/engine.h2
-rw-r--r--src/mongo/scripting/mozjs/global.cpp6
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp16
-rw-r--r--src/mongo/scripting/mozjs/session.cpp3
-rw-r--r--src/mongo/shell/bench.cpp62
-rw-r--r--src/mongo/shell/shell_utils_launcher.cpp66
9 files changed, 88 insertions, 130 deletions
diff --git a/src/mongo/logv2/README.md b/src/mongo/logv2/README.md
index 3d789b8a20a..fd05aafaa65 100644
--- a/src/mongo/logv2/README.md
+++ b/src/mongo/logv2/README.md
@@ -221,7 +221,7 @@ if (condition) {
// Be careful of functions returning by value
attrs.add("extra", getExtraInfo());
}
-LOGV2(1030, "dynamic attributes", attrs);
+LOGV2(1030, "Dynamic attributes", attrs);
```
# Type Support
@@ -334,15 +334,15 @@ mapLog indicates that it is a range coming from an associative container where t
```
std::array<int, 20> arrayOfInts = ...;
-LOGV2(1010, "log container directly: {values}", "values"_attr = arrayOfInts);
-LOGV2(1011, "log iterator range: {values}", "values"_attr = seqLog(arrayOfInts.begin(), arrayOfInts.end());
-LOGV2(1012, "log first five elements: {values}", "values"_attr = seqLog(arrayOfInts.data(), arrayOfInts.data() + 5);
+LOGV2(1010, "Log container directly: {values}", "values"_attr = arrayOfInts);
+LOGV2(1011, "Log iterator range: {values}", "values"_attr = seqLog(arrayOfInts.begin(), arrayOfInts.end());
+LOGV2(1012, "Log first five elements: {values}", "values"_attr = seqLog(arrayOfInts.data(), arrayOfInts.data() + 5);
```
```
StringMap<BSONObj> bsonMap = ...;
-LOGV2(1013, "log map directly: {values}", "values"_attr = bsonMap);
-LOGV2(1014, "log map iterator range: {values}", "values"_attr = mapLog(bsonMap.begin(), bsonMap.end());
+LOGV2(1013, "Log map directly: {values}", "values"_attr = bsonMap);
+LOGV2(1014, "Log map iterator range: {values}", "values"_attr = mapLog(bsonMap.begin(), bsonMap.end());
```
### Duration types
@@ -388,7 +388,7 @@ public:
##### Examples
```
const AnyUserType& t = ...;
-LOGV2(2000, "log of user type", logAttr(t));
+LOGV2(2001, "Log of user type", logAttr(t));
```
## Multiple attributes
@@ -413,9 +413,9 @@ NotALoggableType t = ...;
// These two log statements would produce the same output (apart from different id)
-LOGV2(2001, "Log of non-loggable type's members", logAttrs(t));
+LOGV2(2002, "Log of non-loggable type's members", logAttrs(t));
-LOGV2(2001, "Log of non-loggable type's members", "name"_attr=t.name, "data"_attr=t.data);
+LOGV2(2003, "Log of non-loggable type's members", "name"_attr=t.name, "data"_attr=t.data);
```
diff --git a/src/mongo/scripting/mozjs/cursor_handle.cpp b/src/mongo/scripting/mozjs/cursor_handle.cpp
index 80be58b5370..34ecada45f0 100644
--- a/src/mongo/scripting/mozjs/cursor_handle.cpp
+++ b/src/mongo/scripting/mozjs/cursor_handle.cpp
@@ -78,7 +78,6 @@ void CursorHandleInfo::finalize(js::FreeOp* fop, JSObject* obj) {
try {
LOGV2_INFO(22782,
- "Failed to kill cursor {cursorId} due to {error}",
"Failed to kill cursor",
"cursorId"_attr = cursorId,
"error"_attr = status);
diff --git a/src/mongo/scripting/mozjs/engine.cpp b/src/mongo/scripting/mozjs/engine.cpp
index 557d9a8c0f9..e51784a28bc 100644
--- a/src/mongo/scripting/mozjs/engine.cpp
+++ b/src/mongo/scripting/mozjs/engine.cpp
@@ -83,39 +83,25 @@ mongo::Scope* MozJSScriptEngine::createScopeForCurrentThread(boost::optional<int
void MozJSScriptEngine::interrupt(unsigned opId) {
stdx::lock_guard<Latch> intLock(_globalInterruptLock);
+ auto knownOps = [&]() {
+ std::vector<unsigned> ret;
+ for (auto&& iSc : _opToScopeMap) {
+ ret.push_back(iSc.first);
+ }
+ return ret;
+ };
OpIdToScopeMap::iterator iScope = _opToScopeMap.find(opId);
if (iScope == _opToScopeMap.end()) {
// got interrupt request for a scope that no longer exists
- LOGV2_DEBUG(22783,
- 1,
- "received interrupt request for unknown op: {opId}{printKnownOps_inlock}",
- "opId"_attr = opId,
- "printKnownOps_inlock"_attr = printKnownOps_inlock());
+ LOGV2_DEBUG(22790, 1, "Received interrupt request for unknown op", "opId"_attr = opId);
+ LOGV2_DEBUG(22783, 2, "Ops known during interrupt", "ops"_attr = knownOps());
return;
}
-
- LOGV2_DEBUG(22784,
- 1,
- "interrupting op: {opId}{printKnownOps_inlock}",
- "opId"_attr = opId,
- "printKnownOps_inlock"_attr = printKnownOps_inlock());
+ LOGV2_DEBUG(22808, 1, "Interrupting op", "opId"_attr = opId);
+ LOGV2_DEBUG(22809, 2, "Ops known during interrupt", "ops"_attr = knownOps());
iScope->second->kill();
}
-std::string MozJSScriptEngine::printKnownOps_inlock() {
- str::stream out;
-
- if (shouldLog(logv2::LogSeverity::Debug(2))) {
- out << " known ops: \n";
-
- for (auto&& iSc : _opToScopeMap) {
- out << " " << iSc.first << "\n";
- }
- }
-
- return out;
-}
-
void MozJSScriptEngine::interruptAll() {
stdx::lock_guard<Latch> interruptLock(_globalInterruptLock);
@@ -157,8 +143,8 @@ void MozJSScriptEngine::registerOperation(OperationContext* opCtx, MozJSImplScop
LOGV2_DEBUG(22785,
2,
- "SMScope {reinterpret_cast_uint64_t_scope} registered for op {opId}",
- "reinterpret_cast_uint64_t_scope"_attr = reinterpret_cast<uint64_t>(scope),
+ "scope registered for op",
+ "scope"_attr = reinterpret_cast<uint64_t>(scope),
"opId"_attr = opId);
Status status = opCtx->checkForInterruptNoAssert();
if (!status.isOK()) {
@@ -171,8 +157,8 @@ void MozJSScriptEngine::unregisterOperation(unsigned int opId) {
LOGV2_DEBUG(22786,
2,
- "ImplScope {reinterpret_cast_uint64_t_this} unregistered for op {opId}",
- "reinterpret_cast_uint64_t_this"_attr = reinterpret_cast<uint64_t>(this),
+ "scope unregistered for op",
+ "scope"_attr = reinterpret_cast<uint64_t>(this),
"opId"_attr = opId);
if (opId != 0) {
diff --git a/src/mongo/scripting/mozjs/engine.h b/src/mongo/scripting/mozjs/engine.h
index c8aecdf7fb0..577248dd6d6 100644
--- a/src/mongo/scripting/mozjs/engine.h
+++ b/src/mongo/scripting/mozjs/engine.h
@@ -86,8 +86,6 @@ public:
}
private:
- std::string printKnownOps_inlock();
-
/**
* This mutex protects _opToScopeMap
*/
diff --git a/src/mongo/scripting/mozjs/global.cpp b/src/mongo/scripting/mozjs/global.cpp
index 3ff4f9129ba..e8e8b57e040 100644
--- a/src/mongo/scripting/mozjs/global.cpp
+++ b/src/mongo/scripting/mozjs/global.cpp
@@ -83,10 +83,10 @@ void GlobalInfo::Functions::print::call(JSContext* cx, JS::CallArgs args) {
args.rval().setUndefined();
LOGV2_INFO_OPTIONS(
- 4615635,
+ 20162,
logv2::LogOptions(logv2::LogTag::kPlainShell, logv2::LogTruncation::Disabled),
- "{message}",
- "message"_attr = ss.str());
+ "{jsPrint}",
+ "jsPrint"_attr = ss.str());
}
void GlobalInfo::Functions::version::call(JSContext* cx, JS::CallArgs args) {
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index a68877f46d1..57a5778e30f 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -225,12 +225,10 @@ void MozJSImplScope::_gcCallback(JSContext* rt, JSGCStatus status, void* data) {
}
LOGV2_INFO(22787,
- "MozJS GC {status_JSGC_BEGIN_prologue_epilogue} heap stats - total: "
- "{mongo_sm_get_total_bytes} limit: {mongo_sm_get_max_bytes}",
- "status_JSGC_BEGIN_prologue_epilogue"_attr =
- (status == JSGC_BEGIN ? "prologue" : "epilogue"),
- "mongo_sm_get_total_bytes"_attr = mongo::sm::get_total_bytes(),
- "mongo_sm_get_max_bytes"_attr = mongo::sm::get_max_bytes());
+ "MozJS GC heap stats",
+ "phase"_attr = (status == JSGC_BEGIN ? "prologue" : "epilogue"),
+ "total"_attr = mongo::sm::get_total_bytes(),
+ "limit"_attr = mongo::sm::get_max_bytes());
}
#if __has_feature(address_sanitizer)
@@ -929,10 +927,10 @@ bool MozJSImplScope::_checkErrorState(bool success, bool reportError, bool asser
if (reportError)
LOGV2_INFO_OPTIONS(
- 4635900,
+ 20163,
logv2::LogOptions(logv2::LogTag::kPlainShell, logv2::LogTruncation::Disabled),
- "{message}",
- "message"_attr = redact(_error));
+ "{jsError}",
+ "jsError"_attr = redact(_error));
// Clear the status state
auto status = std::move(_status);
diff --git a/src/mongo/scripting/mozjs/session.cpp b/src/mongo/scripting/mozjs/session.cpp
index c7202314799..6aa805ff425 100644
--- a/src/mongo/scripting/mozjs/session.cpp
+++ b/src/mongo/scripting/mozjs/session.cpp
@@ -153,8 +153,7 @@ void SessionInfo::finalize(js::FreeOp* fop, JSObject* obj) {
try {
LOGV2_INFO(22791,
- "Failed to end session {lsid} due to {error}",
- "Failed to end session",
+ "Failed to end logical session",
"lsid"_attr = lsid,
"error"_attr = status);
} catch (...) {
diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp
index 6edb8cff9ad..b72f47ff162 100644
--- a/src/mongo/shell/bench.cpp
+++ b/src/mongo/shell/bench.cpp
@@ -738,7 +738,7 @@ void BenchRunConfig::initializeFromBson(const BSONObj& args) {
ops.push_back(opFromBson(i.next().Obj()));
}
} else {
- LOGV2_INFO(22793, "benchRun passed an unsupported field: {name}", "name"_attr = name);
+ LOGV2_INFO(22793, "benchRun passed an unsupported field", "name"_attr = name);
uassert(34376, "benchRun passed an unsupported configuration field", false);
}
}
@@ -841,9 +841,8 @@ BenchRunWorker::~BenchRunWorker() {
// before returning from BenchRunWorker's destructor.
_thread.join();
} catch (...) {
- LOGV2_FATAL_CONTINUE(22807,
- "caught exception in destructor: {exceptionToStatus}",
- "exceptionToStatus"_attr = exceptionToStatus());
+ LOGV2_FATAL_CONTINUE(
+ 22807, "Caught exception in destructor", "error"_attr = exceptionToStatus());
std::terminate();
}
}
@@ -918,11 +917,9 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
yesWatch) || // If we're just watching things
(_config->watchPattern && _config->noWatchPattern && yesWatch && !noWatch))
LOGV2_INFO(22794,
- "Error in benchRun thread for op "
- "{kOpTypeNames_find_op_op_second}{causedBy_ex}",
- "kOpTypeNames_find_op_op_second"_attr =
- kOpTypeNames.find(op.op)->second,
- "causedBy_ex"_attr = causedBy(ex));
+ "Error in benchRun thread for op",
+ "op"_attr = kOpTypeNames.find(op.op)->second,
+ "error"_attr = causedBy(ex));
}
bool yesTrap = (_config->trapPattern && _config->trapPattern->FullMatch(ex.what()));
@@ -949,10 +946,8 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
} catch (...) {
if (!_config->hideErrors || op.showError)
LOGV2_INFO(22795,
- "Error in benchRun thread caused by unknown error for op "
- "{kOpTypeNames_find_op_op_second}",
- "kOpTypeNames_find_op_op_second"_attr =
- kOpTypeNames.find(op.op)->second);
+ "Error in benchRun thread caused by unknown error for op",
+ "op"_attr = kOpTypeNames.find(op.op)->second);
if (!_config->handleErrors && !op.handleError)
return;
@@ -1022,9 +1017,7 @@ void BenchRunOp::executeOnce(DBClientBase* conn,
}
if (!config.hideResults || this->showResult)
- LOGV2_INFO(22796,
- "Result from benchRun thread [findOne] : {result}",
- "result"_attr = result);
+ LOGV2_INFO(22796, "Result from benchRun thread [findOne]", "result"_attr = result);
} break;
case OpType::COMMAND: {
bool ok;
@@ -1154,16 +1147,16 @@ void BenchRunOp::executeOnce(DBClientBase* conn,
if (this->expected >= 0 && count != this->expected) {
LOGV2_INFO(22797,
- "bench query on: {this_ns} expected: {this_expected} got: {count}",
- "this_ns"_attr = this->ns,
- "this_expected"_attr = this->expected,
- "count"_attr = count);
+ "Bench query on: {namespace} expected: {expected} got: {got}",
+ "Bench query on namespace got diffrent results then expected",
+ "namespace"_attr = this->ns,
+ "expected"_attr = this->expected,
+ "got"_attr = count);
verify(false);
}
if (!config.hideResults || this->showResult)
- LOGV2_INFO(
- 22798, "Result from benchRun thread [query] : {count}", "count"_attr = count);
+ LOGV2_INFO(22798, "Result from benchRun thread [query]", "count"_attr = count);
} break;
case OpType::UPDATE: {
BSONObj result;
@@ -1233,9 +1226,8 @@ void BenchRunOp::executeOnce(DBClientBase* conn,
if (this->safe) {
if (!config.hideResults || this->showResult)
- LOGV2_INFO(22799,
- "Result from benchRun thread [safe update] : {result}",
- "result"_attr = result);
+ LOGV2_INFO(
+ 22799, "Result from benchRun thread [safe update]", "result"_attr = result);
if (!result["err"].eoo() && result["err"].type() == String &&
(config.throwGLE || this->throwGLE))
@@ -1299,9 +1291,8 @@ void BenchRunOp::executeOnce(DBClientBase* conn,
if (this->safe) {
if (!config.hideResults || this->showResult)
- LOGV2_INFO(22800,
- "Result from benchRun thread [safe insert] : {result}",
- "result"_attr = result);
+ LOGV2_INFO(
+ 22800, "Result from benchRun thread [safe insert]", "result"_attr = result);
if (!result["err"].eoo() && result["err"].type() == String &&
(config.throwGLE || this->throwGLE))
@@ -1346,9 +1337,8 @@ void BenchRunOp::executeOnce(DBClientBase* conn,
if (this->safe) {
if (!config.hideResults || this->showResult)
- LOGV2_INFO(22801,
- "Result from benchRun thread [safe remove] : {result}",
- "result"_attr = result);
+ LOGV2_INFO(
+ 22801, "Result from benchRun thread [safe remove]", "result"_attr = result);
if (!result["err"].eoo() && result["err"].type() == String &&
(config.throwGLE || this->throwGLE))
@@ -1391,13 +1381,11 @@ void BenchRunWorker::run() {
BenchRunWorkerStateGuard workerStateGuard(_brState);
generateLoadOnConnection(conn.get());
} catch (const DBException& e) {
- LOGV2_ERROR(22804,
- "DBException not handled in benchRun thread{causedBy_e}",
- "causedBy_e"_attr = causedBy(e));
+ LOGV2_ERROR(
+ 22804, "DBException not handled in benchRun thread", "error"_attr = causedBy(e));
} catch (const std::exception& e) {
- LOGV2_ERROR(22805,
- "std::exception not handled in benchRun thread{causedBy_e}",
- "causedBy_e"_attr = causedBy(e));
+ LOGV2_ERROR(
+ 22805, "std::exception not handled in benchRun thread", "error"_attr = causedBy(e));
} catch (...) {
LOGV2_ERROR(22806, "Unknown exception not handled in benchRun thread.");
}
diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp
index 33d75743d51..8fcefa3e690 100644
--- a/src/mongo/shell/shell_utils_launcher.cpp
+++ b/src/mongo/shell/shell_utils_launcher.cpp
@@ -129,7 +129,7 @@ void safeClose(int fd) {
#endif
if (close(fd) != 0) {
const auto ewd = errnoWithDescription();
- LOGV2_ERROR(22829, "failed to close fd {fd}: {ewd}", "fd"_attr = fd, "ewd"_attr = ewd);
+ LOGV2_ERROR(22829, "Failed to close fd", "fd"_attr = fd, "error"_attr = ewd);
fassertFailed(40318);
}
}
@@ -419,7 +419,7 @@ void ProgramRunner::start() {
int status = pipe(pipeEnds);
if (status != 0) {
const auto ewd = errnoWithDescription();
- LOGV2_ERROR(22830, "failed to create pipe: {ewd}", "ewd"_attr = ewd);
+ LOGV2_ERROR(22830, "Failed to create pipe", "error"_attr = ewd);
fassertFailed(16701);
}
#ifndef _WIN32
@@ -430,13 +430,13 @@ void ProgramRunner::start() {
status = fcntl(pipeEnds[0], F_SETFD, FD_CLOEXEC);
if (status != 0) {
const auto ewd = errnoWithDescription();
- LOGV2_ERROR(22831, "failed to set FD_CLOEXEC on pipe end 0: {ewd}", "ewd"_attr = ewd);
+ LOGV2_ERROR(22831, "Failed to set FD_CLOEXEC on pipe end 0", "error"_attr = ewd);
fassertFailed(40308);
}
status = fcntl(pipeEnds[1], F_SETFD, FD_CLOEXEC);
if (status != 0) {
const auto ewd = errnoWithDescription();
- LOGV2_ERROR(22832, "failed to set FD_CLOEXEC on pipe end 1: {ewd}", "ewd"_attr = ewd);
+ LOGV2_ERROR(22832, "Failed to set FD_CLOEXEC on pipe end 1", "error"_attr = ewd);
fassertFailed(40317);
}
#endif
@@ -457,14 +457,7 @@ void ProgramRunner::start() {
_pipe = pipeEnds[0];
- {
- stringstream ss;
- ss << "shell: started program (sh" << _pid << "): ";
- for (unsigned i = 0; i < _argv.size(); i++) {
- ss << " " << _argv[i];
- }
- LOGV2_INFO(22810, "{ss_str}", "ss_str"_attr = ss.str());
- }
+ LOGV2_INFO(22810, "shell: Started program", "pid"_attr = _pid, "argv"_attr = _argv);
}
void ProgramRunner::operator()() {
@@ -719,7 +712,7 @@ bool wait_for_pid(ProcessId pid, bool block = true, int* exit_code = nullptr) {
return false;
} else if (ret != WAIT_OBJECT_0) {
const auto ewd = errnoWithDescription();
- LOGV2_INFO(22811, "wait_for_pid: WaitForSingleObject failed: {ewd}", "ewd"_attr = ewd);
+ LOGV2_INFO(22811, "wait_for_pid: WaitForSingleObject failed", "error"_attr = ewd);
}
DWORD tmp;
@@ -738,7 +731,7 @@ bool wait_for_pid(ProcessId pid, bool block = true, int* exit_code = nullptr) {
return true;
} else {
const auto ewd = errnoWithDescription();
- LOGV2_INFO(22812, "GetExitCodeProcess failed: {ewd}", "ewd"_attr = ewd);
+ LOGV2_INFO(22812, "GetExitCodeProcess failed", "error"_attr = ewd);
return false;
}
#else
@@ -800,7 +793,7 @@ BSONObj WaitMongoProgram(const BSONObj& a, void* data) {
int exit_code = -123456; // sentinel value
invariant(port >= 0);
if (!registry.isPortRegistered(port)) {
- LOGV2_INFO(22813, "No db started on port: {port}", "port"_attr = port);
+ LOGV2_INFO(22813, "No db started on port", "port"_attr = port);
return BSON(string("") << 0);
}
pid = registry.pidForPort(port);
@@ -897,11 +890,12 @@ void copyDir(const boost::filesystem::path& from, const boost::filesystem::path&
boost::filesystem::copy_file(p, to / p.leaf(), ec);
if (ec) {
LOGV2_INFO(22814,
- "Skipping copying of file from '{p_generic_string}' to "
- "'{to_p_leaf_generic_string}' due to: {ec_message}",
- "p_generic_string"_attr = p.generic_string(),
- "to_p_leaf_generic_string"_attr = (to / p.leaf()).generic_string(),
- "ec_message"_attr = ec.message());
+ "Skipping copying of file from '{from}' to "
+ "'{to}' due to: {error}",
+ "Skipping copying of file due to error"
+ "from"_attr = p.generic_string(),
+ "to"_attr = (to / p.leaf()).generic_string(),
+ "error"_attr = ec.message());
}
} else if (p.leaf() != "mongod.lock" && p.leaf() != "WiredTiger.lock") {
if (boost::filesystem::is_directory(p)) {
@@ -950,14 +944,14 @@ inline void kill_wrapper(ProcessId pid, int sig, int port, const BSONObj& opt) {
int gle = GetLastError();
if (gle != ERROR_FILE_NOT_FOUND) {
const auto ewd = errnoWithDescription();
- LOGV2_WARNING(22827, "kill_wrapper OpenEvent failed: {ewd}", "ewd"_attr = ewd);
+ LOGV2_WARNING(22827, "kill_wrapper OpenEvent failed", "error"_attr = ewd);
} else {
LOGV2_INFO(
22815,
- "kill_wrapper OpenEvent failed to open event to the process {pid_asUInt32}. It "
+ "kill_wrapper OpenEvent failed to open event to the process. It "
"has likely died already or server is running an older version. Attempting to "
"shutdown through admin command.",
- "pid_asUInt32"_attr = pid.asUInt32());
+ "pid"_attr = pid.asUInt32());
// Back-off to the old way of shutting down the server on Windows, in case we
// are managing a pre-2.6.0rc0 service, which did not have the event.
@@ -996,7 +990,7 @@ inline void kill_wrapper(ProcessId pid, int sig, int port, const BSONObj& opt) {
bool result = SetEvent(event);
if (!result) {
const auto ewd = errnoWithDescription();
- LOGV2_ERROR(22833, "kill_wrapper SetEvent failed: {ewd}", "ewd"_attr = ewd);
+ LOGV2_ERROR(22833, "kill_wrapper SetEvent failed", "error"_attr = ewd);
return;
}
#else
@@ -1005,7 +999,7 @@ inline void kill_wrapper(ProcessId pid, int sig, int port, const BSONObj& opt) {
if (errno == ESRCH) {
} else {
const auto ewd = errnoWithDescription();
- LOGV2_INFO(22816, "killFailed: {ewd}", "ewd"_attr = ewd);
+ LOGV2_INFO(22816, "Kill failed", "error"_attr = ewd);
verify(x == 0);
}
}
@@ -1017,7 +1011,7 @@ int killDb(int port, ProcessId _pid, int signal, const BSONObj& opt, bool waitPi
ProcessId pid;
if (port > 0) {
if (!registry.isPortRegistered(port)) {
- LOGV2_INFO(22817, "No db started on port: {port}", "port"_attr = port);
+ LOGV2_INFO(22817, "No db started on port", "port"_attr = port);
return 0;
}
pid = registry.pidForPort(port);
@@ -1029,16 +1023,16 @@ int killDb(int port, ProcessId _pid, int signal, const BSONObj& opt, bool waitPi
// If we are not waiting for the process to end, then return immediately.
if (!waitPid) {
- LOGV2_INFO(22818, "skip waiting for pid {pid} to terminate", "pid"_attr = pid);
+ LOGV2_INFO(22818, "Skip waiting for process to terminate", "pid"_attr = pid);
return 0;
}
int exitCode = EXIT_FAILURE;
try {
- LOGV2_INFO(22819, "waiting for process {pid} to terminate.", "pid"_attr = pid);
+ LOGV2_INFO(22819, "Waiting for process to terminate.", "pid"_attr = pid);
wait_for_pid(pid, true, &exitCode);
} catch (...) {
- LOGV2_WARNING(22828, "process {pid} failed to terminate.", "pid"_attr = pid);
+ LOGV2_WARNING(22828, "Process failed to terminate.", "pid"_attr = pid);
return EXIT_FAILURE;
}
@@ -1102,12 +1096,10 @@ BSONObj StopMongoProgram(const BSONObj& a, void* data) {
uassert(ErrorCodes::FailedToParse, "wrong number of arguments", nFields >= 1 && nFields <= 4);
uassert(ErrorCodes::BadValue, "stopMongoProgram needs a number", a.firstElement().isNumber());
int port = int(a.firstElement().number());
- LOGV2_INFO(22820,
- "shell: stopping mongo program, waitpid={getWaitPid_a}",
- "getWaitPid_a"_attr = getWaitPid(a));
+ LOGV2_INFO(22820, "shell: Stopping mongo program", "waitpid"_attr = getWaitPid(a));
int code =
killDb(port, ProcessId::fromNative(0), getSignal(a), getStopMongodOpts(a), getWaitPid(a));
- LOGV2_INFO(22821, "shell: stopped mongo program on port {port}", "port"_attr = port);
+ LOGV2_INFO(22821, "shell: Stopped mongo program on port", "port"_attr = port);
return BSON("" << (double)code);
}
@@ -1118,7 +1110,7 @@ BSONObj StopMongoProgramByPid(const BSONObj& a, void* data) {
ErrorCodes::BadValue, "stopMongoProgramByPid needs a number", a.firstElement().isNumber());
ProcessId pid = ProcessId::fromNative(int(a.firstElement().number()));
int code = killDb(0, pid, getSignal(a), getStopMongodOpts(a));
- LOGV2_INFO(22822, "shell: stopped mongo program with pid {pid}", "pid"_attr = pid);
+ LOGV2_INFO(22822, "shell: Stopped mongo program with pid", "pid"_attr = pid);
return BSON("" << (double)code);
}
@@ -1138,10 +1130,8 @@ int KillMongoProgramInstances() {
int port = registry.portForPid(pid);
int code = killDb(port != -1 ? port : 0, pid, SIGTERM);
if (code != EXIT_SUCCESS) {
- LOGV2_INFO(22823,
- "Process with pid {pid} exited with error code {code}",
- "pid"_attr = pid,
- "code"_attr = code);
+ LOGV2_INFO(
+ 22823, "Process exited with error code", "pid"_attr = pid, "code"_attr = code);
returnCode = code;
}
}