summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2020-05-06 17:37:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-14 16:24:40 +0000
commita4ceda5972d5125c6165f59c9a49ff12d149a5dd (patch)
tree41709db95677db972359b15cb2ae06f5da2ca8aa /src/mongo/client
parent7ce851cb82032b78a5f87da60e600a3dec1e9ac7 (diff)
downloadmongo-a4ceda5972d5125c6165f59c9a49ff12d149a5dd.tar.gz
SERVER-47921 Clean up LOG lines in client
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/connection_string.cpp2
-rw-r--r--src/mongo/client/dbclient_connection.cpp2
-rw-r--r--src/mongo/client/fetcher.cpp16
-rw-r--r--src/mongo/client/fetcher_test.cpp25
-rw-r--r--src/mongo/client/mongo_uri.cpp2
-rw-r--r--src/mongo/client/remote_command_retry_scheduler.cpp2
-rw-r--r--src/mongo/client/replica_set_monitor.cpp2
-rw-r--r--src/mongo/client/sdam/topology_description.cpp2
-rw-r--r--src/mongo/client/sdam/topology_listener_mock.cpp2
-rw-r--r--src/mongo/client/sdam/topology_manager_test.cpp2
-rw-r--r--src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp2
11 files changed, 31 insertions, 28 deletions
diff --git a/src/mongo/client/connection_string.cpp b/src/mongo/client/connection_string.cpp
index ecd3eb6c5f5..90adb5a5f44 100644
--- a/src/mongo/client/connection_string.cpp
+++ b/src/mongo/client/connection_string.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork
-
#include "mongo/platform/basic.h"
#include "mongo/client/connection_string.h"
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp
index 0d5d10cf3f0..297ae2b1c3f 100644
--- a/src/mongo/client/dbclient_connection.cpp
+++ b/src/mongo/client/dbclient_connection.cpp
@@ -561,7 +561,7 @@ void DBClientConnection::_checkConnection() {
LOGV2_DEBUG(20120,
_logLevel.toInt(),
"Trying to reconnect to {connString}",
- "Trying to reconnnect",
+ "Trying to reconnect",
"connString"_attr = toString());
string errmsg;
auto connectStatus = connect(_serverAddress, _applicationName);
diff --git a/src/mongo/client/fetcher.cpp b/src/mongo/client/fetcher.cpp
index 8e988a89901..ae04a7c4c5c 100644
--- a/src/mongo/client/fetcher.cpp
+++ b/src/mongo/client/fetcher.cpp
@@ -392,14 +392,17 @@ void Fetcher::_sendKillCursors(const CursorId id, const NamespaceString& nss) {
auto logKillCursorsResult = [](const RemoteCommandCallbackArgs& args) {
if (!args.response.isOK()) {
LOGV2_WARNING(23918,
- "killCursors command task failed: {args_response_status}",
- "args_response_status"_attr = redact(args.response.status));
+ "killCursors command task failed: {error}",
+ "killCursors command task failed",
+ "error"_attr = redact(args.response.status));
return;
}
auto status = getStatusFromCommandResult(args.response.data);
if (!status.isOK()) {
- LOGV2_WARNING(
- 23919, "killCursors command failed: {status}", "status"_attr = redact(status));
+ LOGV2_WARNING(23919,
+ "killCursors command failed: {error}",
+ "killCursors command failed",
+ "error"_attr = redact(status));
}
};
auto cmdObj = BSON("killCursors" << nss.coll() << "cursors" << BSON_ARRAY(id));
@@ -407,8 +410,9 @@ void Fetcher::_sendKillCursors(const CursorId id, const NamespaceString& nss) {
RemoteCommandRequest(_source, _dbname, cmdObj, nullptr), logKillCursorsResult);
if (!scheduleResult.isOK()) {
LOGV2_WARNING(23920,
- "failed to schedule killCursors command: {scheduleResult_getStatus}",
- "scheduleResult_getStatus"_attr = redact(scheduleResult.getStatus()));
+ "Failed to schedule killCursors command: {error}",
+ "Failed to schedule killCursors command",
+ "error"_attr = redact(scheduleResult.getStatus()));
}
}
}
diff --git a/src/mongo/client/fetcher_test.cpp b/src/mongo/client/fetcher_test.cpp
index b03ba051978..e8283d1a4a6 100644
--- a/src/mongo/client/fetcher_test.cpp
+++ b/src/mongo/client/fetcher_test.cpp
@@ -836,9 +836,13 @@ TEST_F(FetcherTest, EmptyGetMoreRequestAfterFirstBatchMakesFetcherInactiveAndKil
// killCursors command request will be canceled by executor on shutdown.
tearDown();
- ASSERT_EQUALS(1,
- countTextFormatLogLinesContaining(
- "killCursors command task failed: CallbackCanceled: Callback canceled"));
+ ASSERT_EQUALS(
+ 1,
+ countBSONFormatLogLinesIsSubset(BSON("msg"
+ << "killCursors command task failed"
+ << "attr"
+ << BSON("error"
+ << "CallbackCanceled: Callback canceled"))));
}
void setNextActionToNoAction(const StatusWith<Fetcher::QueryResponse>& fetchResult,
@@ -910,7 +914,12 @@ TEST_F(FetcherTest, UpdateNextActionAfterSecondBatch) {
getNet()->runReadyNetworkOperations();
}
- ASSERT_EQUALS(1, countTextFormatLogLinesContaining("killCursors command failed: UnknownError"));
+ ASSERT_EQUALS(1,
+ countBSONFormatLogLinesIsSubset(BSON("msg"
+ << "killCursors command failed"
+ << "attr"
+ << BSON("error"
+ << "UnknownError: "))));
}
/**
@@ -979,8 +988,12 @@ TEST_F(FetcherTest, ShutdownDuringSecondBatch) {
// Fetcher should attempt (unsuccessfully) to schedule a killCursors command.
ASSERT_EQUALS(1,
- countTextFormatLogLinesContaining("failed to schedule killCursors command: "
- "ShutdownInProgress: Shutdown in progress"));
+ countBSONFormatLogLinesIsSubset(
+ BSON("msg"
+ << "Failed to schedule killCursors command"
+ << "attr"
+ << BSON("error"
+ << "ShutdownInProgress: Shutdown in progress"))));
ASSERT_EQUALS(ErrorCodes::ShutdownInProgress, status.code());
}
diff --git a/src/mongo/client/mongo_uri.cpp b/src/mongo/client/mongo_uri.cpp
index 02f5174484a..f0f8cab0978 100644
--- a/src/mongo/client/mongo_uri.cpp
+++ b/src/mongo/client/mongo_uri.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork
-
#include "mongo/platform/basic.h"
#include "mongo/client/mongo_uri.h"
diff --git a/src/mongo/client/remote_command_retry_scheduler.cpp b/src/mongo/client/remote_command_retry_scheduler.cpp
index ab67ff75c3e..351bf68ecf1 100644
--- a/src/mongo/client/remote_command_retry_scheduler.cpp
+++ b/src/mongo/client/remote_command_retry_scheduler.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kExecutor
-
#include "mongo/platform/basic.h"
#include <algorithm>
diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp
index b7c27f45830..7a3b42ab914 100644
--- a/src/mongo/client/replica_set_monitor.cpp
+++ b/src/mongo/client/replica_set_monitor.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork
-
#include "mongo/platform/basic.h"
#include "mongo/client/replica_set_monitor.h"
diff --git a/src/mongo/client/sdam/topology_description.cpp b/src/mongo/client/sdam/topology_description.cpp
index 6f688367055..edf504f651b 100644
--- a/src/mongo/client/sdam/topology_description.cpp
+++ b/src/mongo/client/sdam/topology_description.cpp
@@ -28,10 +28,8 @@
*/
#include "mongo/client/sdam/topology_description.h"
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork
#include "mongo/client/sdam/server_description.h"
#include "mongo/db/wire_version.h"
-#include "mongo/logv2/log.h"
#include "mongo/util/fail_point.h"
namespace mongo::sdam {
diff --git a/src/mongo/client/sdam/topology_listener_mock.cpp b/src/mongo/client/sdam/topology_listener_mock.cpp
index 22aebbd2c2e..571760d06df 100644
--- a/src/mongo/client/sdam/topology_listener_mock.cpp
+++ b/src/mongo/client/sdam/topology_listener_mock.cpp
@@ -26,8 +26,6 @@
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
-
#include "mongo/platform/basic.h"
#include "mongo/client/sdam/topology_listener_mock.h"
diff --git a/src/mongo/client/sdam/topology_manager_test.cpp b/src/mongo/client/sdam/topology_manager_test.cpp
index d7d63022fc0..2b65fda9d07 100644
--- a/src/mongo/client/sdam/topology_manager_test.cpp
+++ b/src/mongo/client/sdam/topology_manager_test.cpp
@@ -26,8 +26,6 @@
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork
-
#include "mongo/client/sdam/topology_manager.h"
#include <boost/optional/optional_io.hpp>
diff --git a/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp b/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
index b0084985223..ef0eb80e61a 100644
--- a/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
@@ -74,7 +74,7 @@ public:
"handshake"_attr = prePost,
"operationType"_attr = applicationOperation);
for (auto error : errors) {
- LOGV2_INFO(4712106, "Check error ", "error"_attr = ErrorCodes::errorString(error));
+ LOGV2_INFO(4712106, "Check error", "error"_attr = ErrorCodes::errorString(error));
for (int attempt = 0; attempt < numAttempts; attempt++) {
auto result = testSubject->computeErrorActions(
kHost, makeStatus(error), stage, isApplicationOperation, kErrorBson);