Skip to content

Commit a7cda2e

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

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.
@@ -138,6 +138,7 @@
138138
* @author Chuong Ngo
139139
* @author Christoph Strobl
140140
* @author Doménique Tilleuil
141+
* @author Mark Paluch
141142
*/
142143
@SuppressWarnings("deprecation")
143144
public class MongoTemplate implements MongoOperations, ApplicationContextAware {
@@ -664,6 +665,11 @@ public <T> GeoResults<T> geoNear(NearQuery near, Class<T> entityClass, String co
664665
command.put("query", queryMapper.getMappedObject(query, getPersistentEntity(entityClass)));
665666
}
666667

668+
if (LOGGER.isDebugEnabled()) {
669+
LOGGER.debug(String.format("Executing geoNear using: %s for class: %s in collection: %s",
670+
serializeToJsonSafely(command), entityClass, collectionName));
671+
}
672+
667673
CommandResult commandResult = executeCommand(command, this.readPreference);
668674
List<Object> results = (List<Object>) commandResult.get("results");
669675
results = results == null ? Collections.emptyList() : results;

0 commit comments

Comments
 (0)