diff options
author | Jason Rassi <rassi@10gen.com> | 2015-12-30 14:10:53 -0500 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2015-12-30 14:11:13 -0500 |
commit | 7834ab9782d90b82ff023c5c886635962e8d5417 (patch) | |
tree | f72bc76f6de0b7f5e8a43761b1cd8113625e4ae4 /src/mongo/db/instance.cpp | |
parent | 79901a7837f58f2c12d505995a316614e871faef (diff) | |
download | mongo-7834ab9782d90b82ff023c5c886635962e8d5417.tar.gz |
SERVER-21776 Most instance.cpp log msgs should use kCommand component
Diffstat (limited to 'src/mongo/db/instance.cpp')
-rw-r--r-- | src/mongo/db/instance.cpp | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index 2a90fbe18ab..e1cd9230d24 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -513,15 +513,7 @@ void assembleResponse(OperationContext* txn, OpDebug& debug = currentOp.debug(); long long logThreshold = serverGlobalParams.slowMS; - LogComponent responseComponent(LogComponent::kQuery); - if (op == dbInsert || op == dbDelete || op == dbUpdate) { - responseComponent = LogComponent::kWrite; - } else if (isCommand) { - responseComponent = LogComponent::kCommand; - } - - bool shouldLog = - logger::globalLogDomain()->shouldLog(responseComponent, logger::LogSeverity::Debug(1)); + bool shouldLogOpDebug = shouldLog(logger::LogSeverity::Debug(1)); if (op == dbQuery) { if (isCommand) { @@ -533,15 +525,14 @@ void assembleResponse(OperationContext* txn, receivedRpc(txn, c, dbresponse, m); } else if (op == dbGetMore) { if (!receivedGetMore(txn, dbresponse, m, currentOp)) - shouldLog = true; + shouldLogOpDebug = true; } else if (op == dbMsg) { // deprecated - replaced by commands const char* p = dbmsg.getns(); int len = strlen(p); if (len > 400) - log(LogComponent::kQuery) << curTimeMillis64() % 10000 - << " long msg received, len:" << len << endl; + log() << curTimeMillis64() % 10000 << " long msg received, len:" << len << endl; if (strcmp("end", p) == 0) dbresponse.response.setData(opReply, "dbMsg end no longer supported"); @@ -559,10 +550,9 @@ void assembleResponse(OperationContext* txn, logThreshold = 10; receivedKillCursors(txn, m); } else if (op != dbInsert && op != dbUpdate && op != dbDelete) { - log(LogComponent::kQuery) - << " operation isn't supported: " << static_cast<int>(op) << endl; + log() << " operation isn't supported: " << static_cast<int>(op) << endl; currentOp.done(); - shouldLog = true; + shouldLogOpDebug = true; } else { if (remote != DBDirectClient::dummyHost) { const ShardedConnectionInfo* connInfo = ShardedConnectionInfo::get(&c, false); @@ -588,17 +578,15 @@ void assembleResponse(OperationContext* txn, } } catch (const UserException& ue) { LastError::get(c).setLastError(ue.getCode(), ue.getInfo().msg); - MONGO_LOG_COMPONENT(3, responseComponent) << " Caught Assertion in " - << networkOpToString(op) << ", continuing " - << ue.toString() << endl; + LOG(3) << " Caught Assertion in " << networkOpToString(op) << ", continuing " + << ue.toString() << endl; debug.exceptionInfo = ue.getInfo(); } catch (const AssertionException& e) { LastError::get(c).setLastError(e.getCode(), e.getInfo().msg); - MONGO_LOG_COMPONENT(3, responseComponent) << " Caught Assertion in " - << networkOpToString(op) << ", continuing " - << e.toString() << endl; + LOG(3) << " Caught Assertion in " << networkOpToString(op) << ", continuing " + << e.toString() << endl; debug.exceptionInfo = e.getInfo(); - shouldLog = true; + shouldLogOpDebug = true; } } currentOp.ensureStarted(); @@ -607,21 +595,19 @@ void assembleResponse(OperationContext* txn, logThreshold += currentOp.getExpectedLatencyMs(); - if (shouldLog || debug.executionTime > logThreshold) { + if (shouldLogOpDebug || debug.executionTime > logThreshold) { Locker::LockerInfo lockerInfo; txn->lockState()->getLockerInfo(&lockerInfo); - MONGO_LOG_COMPONENT(0, responseComponent) << debug.report(currentOp, lockerInfo.stats); + log() << debug.report(currentOp, lockerInfo.stats); } if (currentOp.shouldDBProfile(debug.executionTime)) { // Performance profiling is on if (txn->lockState()->isReadLocked()) { - MONGO_LOG_COMPONENT(1, responseComponent) - << "note: not profiling because recursive read lock"; + LOG(1) << "note: not profiling because recursive read lock"; } else if (lockedForWriting()) { - MONGO_LOG_COMPONENT(1, responseComponent) - << "note: not profiling because doing fsync+lock"; + LOG(1) << "note: not profiling because doing fsync+lock"; } else { profile(txn, op); } |