From de0feed565772147d901bc6fb61fea485c2a554f Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 15 Mar 2016 16:22:48 +0100 Subject: [PATCH] =?UTF-8?q?DATAMONGO-1397=20-=20Log=20command,=20entity=20?= =?UTF-8?q?and=20collection=20name=20in=20MongoTemplate.geoNear(=E2=80=A6)?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original pull request: #348. --- .../springframework/data/mongodb/core/MongoTemplate.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java index 476f2df5f..7cb418e68 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -137,6 +137,7 @@ import com.mongodb.util.JSONParseException; * @author Chuong Ngo * @author Christoph Strobl * @author Doménique Tilleuil + * @author Mark Paluch */ @SuppressWarnings("deprecation") public class MongoTemplate implements MongoOperations, ApplicationContextAware { @@ -640,6 +641,11 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware { command.put("query", queryMapper.getMappedObject(query, getPersistentEntity(entityClass))); } + if (LOGGER.isDebugEnabled()) { + LOGGER.debug(String.format("Executing geoNear using: %s for class: %s in collection: %s", + serializeToJsonSafely(command), entityClass, collectionName)); + } + CommandResult commandResult = executeCommand(command, this.readPreference); List results = (List) commandResult.get("results"); results = results == null ? Collections.emptyList() : results;