Skip to content

Commit de0feed

Browse files
mp911deodrotbohm
authored andcommitted
DATAMONGO-1397 - Log command, entity and collection name in MongoTemplate.geoNear(…).
Original pull request: #348.
1 parent bb2271e commit de0feed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2015 the original author or authors.
2+
* Copyright 2010-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -137,6 +137,7 @@
137137
* @author Chuong Ngo
138138
* @author Christoph Strobl
139139
* @author Doménique Tilleuil
140+
* @author Mark Paluch
140141
*/
141142
@SuppressWarnings("deprecation")
142143
public class MongoTemplate implements MongoOperations, ApplicationContextAware {
@@ -640,6 +641,11 @@ public <T> GeoResults<T> geoNear(NearQuery near, Class<T> entityClass, String co
640641
command.put("query", queryMapper.getMappedObject(query, getPersistentEntity(entityClass)));
641642
}
642643

644+
if (LOGGER.isDebugEnabled()) {
645+
LOGGER.debug(String.format("Executing geoNear using: %s for class: %s in collection: %s",
646+
serializeToJsonSafely(command), entityClass, collectionName));
647+
}
648+
643649
CommandResult commandResult = executeCommand(command, this.readPreference);
644650
List<Object> results = (List<Object>) commandResult.get("results");
645651
results = results == null ? Collections.emptyList() : results;

0 commit comments

Comments
 (0)