Skip to content

Commit 962dd70

Browse files
authored
[mongodb] hide the connection uri from logs (#1654)
1 parent 0ee90ca commit 962dd70

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tensorflow_io/core/kernels/mongodb_kernels.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ class MongoDBReadableResource : public ResourceBase {
3939
// Required to initialize libmongoc's internals
4040
mongoc_init();
4141

42-
// Log the uri
43-
LOG(INFO) << "Connecting to: " << uri;
44-
4542
// Create a MongoDB URI object from the given string
4643

4744
uri_obj_ = mongoc_uri_new_with_error(uri.c_str(), &error_);
@@ -128,7 +125,7 @@ class MongoDBReadableResource : public ResourceBase {
128125
return errors::FailedPrecondition(
129126
"Failed to ping the mongo cluster due to: ", error_.message);
130127
}
131-
LOG(ERROR) << "Ping Successful";
128+
LOG(INFO) << "MongoDB connection ping successful";
132129

133130
return Status::OK();
134131
}
@@ -222,9 +219,6 @@ class MongoDBWritableResource : public ResourceBase {
222219
// Required to initialize libmongoc's internals
223220
mongoc_init();
224221

225-
// Log the uri
226-
LOG(INFO) << "Connecting to: " << uri;
227-
228222
// Create a MongoDB URI object from the given string
229223

230224
uri_obj_ = mongoc_uri_new_with_error(uri.c_str(), &error_);
@@ -308,7 +302,7 @@ class MongoDBWritableResource : public ResourceBase {
308302
return errors::FailedPrecondition(
309303
"Failed to ping the mongo cluster due to: ", error_.message);
310304
}
311-
LOG(INFO) << "Ping Successful";
305+
LOG(INFO) << "MongoDB connection ping successful";
312306

313307
return Status::OK();
314308
}

0 commit comments

Comments
 (0)