diff options
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r-- | src/mongo/db/introspect.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index 82993e676c9..87819671ad4 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -42,6 +42,7 @@ #include "mongo/db/curop.h" #include "mongo/db/db_raii.h" #include "mongo/db/jsobj.h" +#include "mongo/logv2/log.h" #include "mongo/rpc/metadata/client_metadata.h" #include "mongo/rpc/metadata/client_metadata_ismaster.h" #include "mongo/util/log.h" @@ -159,8 +160,9 @@ void profile(OperationContext* opCtx, NetworkOp op) { Database* const db = autoGetDb->getDb(); if (!db) { // Database disappeared - log() << "note: not profiling because db went away for " - << CurOp::get(opCtx)->getNS(); + LOGV2(20700, + "note: not profiling because db went away for {CurOp_get_opCtx_getNS}", + "CurOp_get_opCtx_getNS"_attr = CurOp::get(opCtx)->getNS()); break; } @@ -201,14 +203,21 @@ void profile(OperationContext* opCtx, NetworkOp op) { } } catch (const AssertionException& assertionEx) { if (acquireDbXLock && ErrorCodes::isInterruption(assertionEx)) { - warning() - << "Interrupted while attempting to create profile collection in database " - << dbName << " to profile operation " << networkOpToString(op) << " against " - << CurOp::get(opCtx)->getNS() - << ". Manually create profile collection to ensure future operations are logged."; + LOGV2_WARNING( + 20702, + "Interrupted while attempting to create profile collection in database {dbName} to " + "profile operation {networkOpToString_op} against {CurOp_get_opCtx_getNS}. " + "Manually create profile collection to ensure future operations are logged.", + "dbName"_attr = dbName, + "networkOpToString_op"_attr = networkOpToString(op), + "CurOp_get_opCtx_getNS"_attr = CurOp::get(opCtx)->getNS()); } else { - warning() << "Caught Assertion while trying to profile " << networkOpToString(op) - << " against " << CurOp::get(opCtx)->getNS() << ": " << redact(assertionEx); + LOGV2_WARNING(20703, + "Caught Assertion while trying to profile {networkOpToString_op} against " + "{CurOp_get_opCtx_getNS}: {assertionEx}", + "networkOpToString_op"_attr = networkOpToString(op), + "CurOp_get_opCtx_getNS"_attr = CurOp::get(opCtx)->getNS(), + "assertionEx"_attr = redact(assertionEx)); } } } @@ -231,7 +240,9 @@ Status createProfileCollection(OperationContext* opCtx, Database* db) { } // system.profile namespace doesn't exist; create it - log() << "Creating profile collection: " << dbProfilingNS; + LOGV2(20701, + "Creating profile collection: {dbProfilingNS}", + "dbProfilingNS"_attr = dbProfilingNS); CollectionOptions collectionOptions; collectionOptions.capped = true; |