Skip to content

Commit 6c0dd2c

Browse files
Cimon Lucas (LCM)mp911de
Cimon Lucas (LCM)
authored andcommitted
DATAMONGO-2148 - Add query logging for MongoTemplate.count(…).
Original pull request: #620.
1 parent 28d96f5 commit 6c0dd2c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

+4
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,10 @@ public long count(Query query, @Nullable Class<?> entityClass, String collection
11241124

11251125
protected long doCount(String collectionName, Document filter, CountOptions options) {
11261126

1127+
if (LOGGER.isDebugEnabled()) {
1128+
LOGGER.debug("Executing count: {} in collection: {}", serializeToJsonSafely(filter), collectionName);
1129+
}
1130+
11271131
if (MongoDatabaseUtils.isTransactionActive(getMongoDbFactory())) {
11281132
return execute(collectionName, collection -> collection.countDocuments(filter, options));
11291133
}

0 commit comments

Comments
 (0)