diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2020-05-27 14:26:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-28 17:57:43 +0000 |
commit | 523613ab819cdf1098251c2dd33d813307bd61a2 (patch) | |
tree | ee853b5453a2ef373e725bd45b9fde8827ce70b5 | |
parent | a7541c60e5904e7deafdedf5bb040cc8924ac7d3 (diff) | |
download | mongo-523613ab819cdf1098251c2dd33d813307bd61a2.tar.gz |
SERVER-48351 Clean up additional logv2 lines
21 files changed, 51 insertions, 61 deletions
diff --git a/src/mongo/db/auth/authorization_session.cpp b/src/mongo/db/auth/authorization_session.cpp index d32bdac5d8d..caed33df1b9 100644 --- a/src/mongo/db/auth/authorization_session.cpp +++ b/src/mongo/db/auth/authorization_session.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/platform/basic.h" #include "mongo/db/auth/authorization_session.h" diff --git a/src/mongo/db/auth/authorization_session_impl.cpp b/src/mongo/db/auth/authorization_session_impl.cpp index a2861cb9eac..6689dcb8458 100644 --- a/src/mongo/db/auth/authorization_session_impl.cpp +++ b/src/mongo/db/auth/authorization_session_impl.cpp @@ -803,7 +803,7 @@ void AuthorizationSessionImpl::_refreshUserInfoAsNeeded(OperationContext* opCtx) "Removed user from session cache of user information because of " "refresh failure", "user"_attr = name, - "status"_attr = status); + "error"_attr = status); continue; // No need to advance "it" in this case. } default: @@ -815,7 +815,7 @@ void AuthorizationSessionImpl::_refreshUserInfoAsNeeded(OperationContext* opCtx) "Could not fetch updated user privilege information, continuing " "to use old information" "user"_attr = name, - "status"_attr = redact(status)); + "error"_attr = redact(status)); removeGuard.dismiss(); break; } diff --git a/src/mongo/db/auth/authz_manager_external_state_d.cpp b/src/mongo/db/auth/authz_manager_external_state_d.cpp index 5dada997580..2d143fee899 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_d.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/platform/basic.h" #include "mongo/db/auth/authz_manager_external_state_d.h" diff --git a/src/mongo/db/auth/authz_manager_external_state_local.cpp b/src/mongo/db/auth/authz_manager_external_state_local.cpp index 9e575b76cdd..89ad8fbe7a5 100644 --- a/src/mongo/db/auth/authz_manager_external_state_local.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_local.cpp @@ -58,12 +58,12 @@ Status AuthzManagerExternalStateLocal::initialize(OperationContext* opCtx) { LOGV2_ERROR(23750, "Cycle detected in admin.system.roles; role inheritance disabled. " "Remove the listed cycle and any others to re-enable role inheritance", - "status"_attr = redact(status)); + "error"_attr = redact(status)); } else { LOGV2_ERROR(23751, "Could not generate role graph from admin.system.roles; " "only system roles available", - "status"_attr = redact(status)); + "error"_attr = redact(status)); } } @@ -472,7 +472,7 @@ void addRoleFromDocumentOrWarn(RoleGraph* roleGraph, const BSONObj& doc) { LOGV2_WARNING(23747, "Skipping invalid admin.system.roles document while calculating privileges" " for user-defined roles", - "status"_attr = redact(status), + "error"_attr = redact(status), "doc"_attr = redact(doc)); } } @@ -503,7 +503,7 @@ Status AuthzManagerExternalStateLocal::_initializeRoleGraph(OperationContext* op LOGV2_ERROR(23752, "Inconsistent role graph during authorization manager initialization. Only " "direct privileges available.", - "status"_attr = redact(status)); + "error"_attr = redact(status)); newState = roleGraphStateHasCycle; status = Status::OK(); } else if (status.isOK()) { @@ -588,14 +588,14 @@ private: LOGV2_ERROR(23753, "Unsupported modification to roles collection in oplog; " "restart this process to reenable user-defined roles", - "status"_attr = redact(status), + "error"_attr = redact(status), "entry"_attr = redact(oplogEntryBuilder.done())); // If a setParameter is enabled, this condition is fatal. fassert(51152, !roleGraphInvalidationIsFatal); } else if (!status.isOK()) { LOGV2_WARNING(23748, "Skipping bad update to roles collection in oplog", - "status"_attr = redact(status), + "error"_attr = redact(status), "op"_attr = redact(_op)); } status = _externalState->_roleGraph.recomputePrivilegeData(); @@ -604,7 +604,7 @@ private: LOGV2_ERROR(23754, "Inconsistent role graph during authorization manager initialization. " "Only direct privileges available after applying oplog entry", - "status"_attr = redact(status), + "error"_attr = redact(status), "op"_attr = redact(_op)); } else { fassert(17183, status); diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp index 8d56da8cb59..95e906a8acc 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/platform/basic.h" #include "mongo/db/auth/authz_manager_external_state_s.h" diff --git a/src/mongo/db/auth/resource_pattern.cpp b/src/mongo/db/auth/resource_pattern.cpp index 4635e83c4e3..3f69b71bafa 100644 --- a/src/mongo/db/auth/resource_pattern.cpp +++ b/src/mongo/db/auth/resource_pattern.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/platform/basic.h" #include <iostream> diff --git a/src/mongo/db/auth/sasl_authentication_session_test.cpp b/src/mongo/db/auth/sasl_authentication_session_test.cpp index 569d2cc6967..7e4bd3766c8 100644 --- a/src/mongo/db/auth/sasl_authentication_session_test.cpp +++ b/src/mongo/db/auth/sasl_authentication_session_test.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest - #include <string> #include <vector> diff --git a/src/mongo/db/auth/sasl_mechanism_registry.cpp b/src/mongo/db/auth/sasl_mechanism_registry.cpp index b8c66a9f642..b2c47eed923 100644 --- a/src/mongo/db/auth/sasl_mechanism_registry.cpp +++ b/src/mongo/db/auth/sasl_mechanism_registry.cpp @@ -191,6 +191,7 @@ ServiceContext::ConstructorActionRegisterer SASLServerMechanismRegistryValidatio if (it == supportedMechanisms.end()) { LOGV2_ERROR(47429001, "SASL Mechanism '{mechanism}' is not supported", + "Unsupported SASL mechanism", "mechanism"_attr = mech); // Quick Exit since we are in the middle of setting up ServiceContext diff --git a/src/mongo/db/auth/sasl_options_init.cpp b/src/mongo/db/auth/sasl_options_init.cpp index 930e8bc4f7c..21050612cbd 100644 --- a/src/mongo/db/auth/sasl_options_init.cpp +++ b/src/mongo/db/auth/sasl_options_init.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/db/auth/sasl_options.h" #include "mongo/db/auth/sasl_options_gen.h" diff --git a/src/mongo/db/auth/sasl_scram_server_conversation.cpp b/src/mongo/db/auth/sasl_scram_server_conversation.cpp index c0dea3a9015..ece08adec08 100644 --- a/src/mongo/db/auth/sasl_scram_server_conversation.cpp +++ b/src/mongo/db/auth/sasl_scram_server_conversation.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/platform/basic.h" #include "mongo/db/auth/sasl_scram_server_conversation.h" diff --git a/src/mongo/db/auth/security_file.cpp b/src/mongo/db/auth/security_file.cpp index e1e710b0a07..70af00a9c76 100644 --- a/src/mongo/db/auth/security_file.cpp +++ b/src/mongo/db/auth/security_file.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kAccessControl - #include "mongo/platform/basic.h" #include "mongo/db/auth/security_key.h" diff --git a/src/mongo/db/auth/security_key.cpp b/src/mongo/db/auth/security_key.cpp index 2dc7a92e5b7..a9b012543fe 100644 --- a/src/mongo/db/auth/security_key.cpp +++ b/src/mongo/db/auth/security_key.cpp @@ -86,7 +86,7 @@ public: if (!swSaslPassword.isOK()) { LOGV2_ERROR(20256, "Could not prep security key file for SCRAM-SHA-256", - "status"_attr = swSaslPassword.getStatus()); + "error"_attr = swSaslPassword.getStatus()); return boost::none; } const auto passwordDigest = mongo::createPasswordDigest( @@ -138,7 +138,7 @@ using std::string; bool setUpSecurityKey(const string& filename) { auto swKeyStrings = mongo::readSecurityFile(filename); if (!swKeyStrings.isOK()) { - LOGV2(20254, "Read security file failed", "status"_attr = swKeyStrings.getStatus()); + LOGV2(20254, "Read security file failed", "error"_attr = swKeyStrings.getStatus()); return false; } @@ -146,9 +146,10 @@ bool setUpSecurityKey(const string& filename) { if (keyStrings.size() > 2) { LOGV2_ERROR(20258, - "Only two keys are supported in the security key file, {size} are " + "Only two keys are supported in the security key file, {numKeys} are " "specified in {filename}", - "size"_attr = keyStrings.size(), + "Only two keys are supported in the security key file", + "numKeys"_attr = keyStrings.size(), "filename"_attr = filename); return false; } diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp index ab1eed0829e..9849ee65ed2 100644 --- a/src/mongo/db/auth/user_cache_invalidator_job.cpp +++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp @@ -67,6 +67,7 @@ public: LOGV2_DEBUG(20259, 5, "setInterval: old={previousInterval}, new={newInterval}", + "setInterval", "previousInterval"_attr = _interval, "newInterval"_attr = interval); _interval = interval; @@ -102,6 +103,7 @@ public: LOGV2_DEBUG(20260, 5, "wait: now={now}, expiry={expiry}", + "wait", "now"_attr = now, "expiry"_attr = expiry); @@ -198,7 +200,7 @@ void UserCacheInvalidator::initialize(OperationContext* opCtx) { LOGV2_WARNING(20265, "An error occurred while fetching initial user cache generation from config " "servers", - "status"_attr = swCurrentGeneration.getStatus()); + "error"_attr = swCurrentGeneration.getStatus()); _previousGeneration = OID(); } @@ -213,13 +215,13 @@ void UserCacheInvalidator::run() { LOGV2_WARNING(20266, "An error occurred while fetching current user cache generation from " "config servers", - "status"_attr = swCurrentGeneration.getStatus()); + "error"_attr = swCurrentGeneration.getStatus()); // When in doubt, invalidate the cache try { _authzManager->invalidateUserCache(opCtx.get()); } catch (const DBException& e) { - LOGV2_WARNING(20267, "Error invalidating user cache", "status"_attr = e.toStatus()); + LOGV2_WARNING(20267, "Error invalidating user cache", "error"_attr = e.toStatus()); } continue; } @@ -228,13 +230,14 @@ void UserCacheInvalidator::run() { LOGV2(20263, "User cache generation changed from {previousGeneration} to " "{currentGeneration}; invalidating user cache", + "User cache generation changed; invalidating user cache", "previousGeneration"_attr = oidOrTimestampToString(_previousGeneration), "currentGeneration"_attr = oidOrTimestampToString(swCurrentGeneration.getValue())); try { _authzManager->invalidateUserCache(opCtx.get()); } catch (const DBException& e) { - LOGV2_WARNING(20268, "Error invalidating user cache", "status"_attr = e.toStatus()); + LOGV2_WARNING(20268, "Error invalidating user cache", "error"_attr = e.toStatus()); } _previousGeneration = swCurrentGeneration.getValue(); } diff --git a/src/mongo/db/auth/user_document_parser.cpp b/src/mongo/db/auth/user_document_parser.cpp index c60f2c35a95..dfa58572069 100644 --- a/src/mongo/db/auth/user_document_parser.cpp +++ b/src/mongo/db/auth/user_document_parser.cpp @@ -478,7 +478,7 @@ Status V2UserDocumentParser::initializeUserPrivilegesFromUserDocument(const BSON LOGV2_WARNING(23745, "Could not parse privilege element in user document", "user"_attr = user->getName(), - "status"_attr = causedBy(status)); + "error"_attr = causedBy(status)); continue; } if (unrecognizedActions.size()) { @@ -487,6 +487,7 @@ Status V2UserDocumentParser::initializeUserPrivilegesFromUserDocument(const BSON LOGV2_WARNING(23746, "Encountered unrecognized actions \"{action}\" while " "parsing user document for {user}", + "Encountered unrecognized actions while parsing user document", "action"_attr = unrecognizedActionsString, "user"_attr = user->getName()); } diff --git a/src/mongo/db/ftdc/controller.cpp b/src/mongo/db/ftdc/controller.cpp index edea5b8a8ef..4486ec7e345 100644 --- a/src/mongo/db/ftdc/controller.cpp +++ b/src/mongo/db/ftdc/controller.cpp @@ -183,7 +183,7 @@ void FTDCController::stop() { if (!s.isOK()) { LOGV2(20627, "Failed to close full-time diagnostic data capture file manager", - "status"_attr = s); + "error"_attr = s); } } } diff --git a/src/mongo/db/ftdc/file_manager.cpp b/src/mongo/db/ftdc/file_manager.cpp index b9422079c74..fc1c2a9a025 100644 --- a/src/mongo/db/ftdc/file_manager.cpp +++ b/src/mongo/db/ftdc/file_manager.cpp @@ -276,7 +276,7 @@ FTDCFileManager::recoverInterimFile() { LOGV2(20630, "Unclean full-time diagnostic data capture shutdown detected, found interim file, " "but failed to open it, some metrics may have been lost", - "status"_attr = s); + "error"_attr = s); // Note: We ignore any actual errors as reading from the interim files is a best-effort return docs; @@ -294,7 +294,7 @@ FTDCFileManager::recoverInterimFile() { LOGV2(20631, "Unclean full-time diagnostic data capture shutdown detected, found interim file, " "some metrics may have been lost", - "status"_attr = m.getStatus()); + "error"_attr = m.getStatus()); } // Note: We ignore any actual errors as reading from the interim files is a best-effort diff --git a/src/mongo/db/ftdc/file_manager_test.cpp b/src/mongo/db/ftdc/file_manager_test.cpp index 801bb8a3a86..908389f6e62 100644 --- a/src/mongo/db/ftdc/file_manager_test.cpp +++ b/src/mongo/db/ftdc/file_manager_test.cpp @@ -116,6 +116,7 @@ TEST_F(FTDCFileManagerTest, TestFull) { ASSERT_TRUE(fs < c.maxFileSizeBytes * 1.10); LOGV2(20632, "File {fileName} has size {fileSize}", + "File size", "fileName"_attr = file.generic_string(), "fileSize"_attr = fs); if (file.generic_string().find("interim") == std::string::npos) { diff --git a/src/mongo/db/ftdc/file_writer.cpp b/src/mongo/db/ftdc/file_writer.cpp index 03ebd6560df..6eaa88ee872 100644 --- a/src/mongo/db/ftdc/file_writer.cpp +++ b/src/mongo/db/ftdc/file_writer.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kFTDC - #include "mongo/platform/basic.h" #include "mongo/db/ftdc/file_writer.h" diff --git a/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp b/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp index 3cded8a6a95..eb877638a7b 100644 --- a/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp +++ b/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp @@ -146,7 +146,7 @@ void installSystemMetricsCollector(FTDCController* controller) { if (!swCollector.getStatus().isOK()) { LOGV2_WARNING(23718, "Failed to initialize Performance Counters for FTDC", - "status"_attr = swCollector.getStatus()); + "error"_attr = swCollector.getStatus()); return; } diff --git a/src/mongo/idl/config_option_test.cpp b/src/mongo/idl/config_option_test.cpp index a0c3267fe84..3b7509a38b1 100644 --- a/src/mongo/idl/config_option_test.cpp +++ b/src/mongo/idl/config_option_test.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest - #include "mongo/platform/basic.h" #include "mongo/idl/config_option_no_init_test_gen.h" diff --git a/src/mongo/idl/server_parameter.cpp b/src/mongo/idl/server_parameter.cpp index 9876082b0ef..b0cd8c6d16e 100644 --- a/src/mongo/idl/server_parameter.cpp +++ b/src/mongo/idl/server_parameter.cpp @@ -82,10 +82,10 @@ ServerParameterSet* ServerParameterSet::getGlobal() { void ServerParameterSet::add(ServerParameter* sp) { ServerParameter*& x = _map[sp->name()]; if (x) { - LOGV2_FATAL_CONTINUE(23784, - "'{x_name}' already exists in the server parameter set.", - "x_name"_attr = x->name()); - abort(); + LOGV2_FATAL(23784, + "'{name}' already exists in the server parameter set", + "Duplicate server parameter registration", + "name"_attr = x->name()); } x = sp; } @@ -135,33 +135,36 @@ void IDLServerParameterDeprecatedAlias::append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& fieldName) { std::call_once(_warnOnce, [&] { - LOGV2_WARNING( - 23781, - "Use of deprecated server parameter '{name}', please use '{sp_name}' instead.", - "name"_attr = name(), - "sp_name"_attr = _sp->name()); + LOGV2_WARNING(23781, + "Use of deprecated server parameter '{deprecatedName}', " + "please use '{canonicalName}' instead", + "Use of deprecated server parameter name", + "deprecatedName"_attr = name(), + "canonicalName"_attr = _sp->name()); }); _sp->append(opCtx, b, fieldName); } Status IDLServerParameterDeprecatedAlias::set(const BSONElement& newValueElement) { std::call_once(_warnOnce, [&] { - LOGV2_WARNING( - 23782, - "Use of deprecated server parameter '{name}', please use '{sp_name}' instead.", - "name"_attr = name(), - "sp_name"_attr = _sp->name()); + LOGV2_WARNING(23782, + "Use of deprecated server parameter '{deprecatedName}', " + "please use '{canonicalName}' instead", + "Use of deprecated server parameter name", + "deprecatedName"_attr = name(), + "canonicalName"_attr = _sp->name()); }); return _sp->set(newValueElement); } Status IDLServerParameterDeprecatedAlias::setFromString(const std::string& str) { std::call_once(_warnOnce, [&] { - LOGV2_WARNING( - 23783, - "Use of deprecated server parameter '{name}', please use '{sp_name}' instead.", - "name"_attr = name(), - "sp_name"_attr = _sp->name()); + LOGV2_WARNING(23783, + "Use of deprecated server parameter '{deprecatedName}', " + "please use '{canonicalName}' instead", + "Use of deprecated server parameter name", + "deprecatedName"_attr = name(), + "canonicalName"_attr = _sp->name()); }); return _sp->setFromString(str); } |