diff options
author | David Storch <david.storch@10gen.com> | 2014-09-22 11:12:08 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-09-22 11:12:08 -0400 |
commit | e0fd81f00395ae2fde5c4e5f170590913d98cbf0 (patch) | |
tree | f7c02c08a3f8f97f8cc9a41eadb24d5e27eddc04 | |
parent | f27db81a93a11e6191c24738a92d6873860731c8 (diff) | |
download | mongo-e0fd81f00395ae2fde5c4e5f170590913d98cbf0.tar.gz |
SERVER-14964 collect debug stats for find and update if log level is greater than zero
-rw-r--r-- | src/mongo/db/ops/update.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/query/new_find.cpp | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index f9c628ea20f..0cea2598963 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -796,10 +796,11 @@ namespace mongo { invariant(cc().database()); invariant(cc().curop()); - // If profiling is enabled or this update has taken longer than slowMs, then get - // debug information from the query runner. + // If profiling is enabled, this update has taken longer than slowMs, or the logLevel + // is at least set to logLevel 1, then get debug information from the query runner. if (cc().database()->getProfilingLevel() > 0 || - cc().curop()->elapsedMillis() > serverGlobalParams.slowMS) { + cc().curop()->elapsedMillis() > serverGlobalParams.slowMS || + logger::globalLogDomain()->shouldLog(logger::LogSeverity::Debug(1))) { TypeExplain* rawExplain; Status infoStatus = runner->getInfo(&rawExplain, NULL); if (infoStatus.isOK()) { diff --git a/src/mongo/db/query/new_find.cpp b/src/mongo/db/query/new_find.cpp index 2848e8300b8..4bd35a2ded8 100644 --- a/src/mongo/db/query/new_find.cpp +++ b/src/mongo/db/query/new_find.cpp @@ -685,14 +685,16 @@ namespace mongo { // Get explain information if: // 1) it is needed by an explain query; - // 2) profiling is enabled; or - // 3) profiling is disabled but we still need explain details to log a "slow" query. + // 2) profiling is enabled; + // 3) profiling is disabled but we still need explain details to log a "slow" query; or + // 4) the log level is set to at least logLevel 1. // Producing explain information is expensive and should be done only if we are certain // the information will be used. boost::scoped_ptr<TypeExplain> explain(NULL); if (isExplain || ctx.ctx().db()->getProfilingLevel() > 0 || - elapsedMillis > serverGlobalParams.slowMS) { + elapsedMillis > serverGlobalParams.slowMS || + logger::globalLogDomain()->shouldLog(logger::LogSeverity::Debug(1))) { // Ask the runner to produce explain information. TypeExplain* bareExplain; Status res = runner->getInfo(&bareExplain, NULL); |