added collection name to logging messages
This commit is contained in:
@@ -714,7 +714,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
}
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("insert DBObject containing fields: " + dbDoc.keySet());
|
||||
LOGGER.debug("insert DBObject containing fields: " + dbDoc.keySet() + " in collecion: " + collectionName);
|
||||
}
|
||||
return execute(collectionName, new CollectionCallback<Object>() {
|
||||
public Object doInCollection(DBCollection collection) throws MongoException, DataAccessException {
|
||||
@@ -813,6 +813,9 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#updateFirst(java.lang.String, com.mongodb.DBObject, com.mongodb.DBObject)
|
||||
*/
|
||||
public WriteResult updateFirst(String collectionName, final Query query, final Update update) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("calling update using query: " + query.getQueryObject() + " and update: " + update.getUpdateObject() + " in collecion: " + collectionName);
|
||||
}
|
||||
return execute(collectionName, new CollectionCallback<WriteResult>() {
|
||||
public WriteResult doInCollection(DBCollection collection) throws MongoException, DataAccessException {
|
||||
WriteResult wr;
|
||||
@@ -838,6 +841,9 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#updateMulti(java.lang.String, com.mongodb.DBObject, com.mongodb.DBObject)
|
||||
*/
|
||||
public WriteResult updateMulti(String collectionName, final Query query, final Update update) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("calling updateMulti using query: " + query.getQueryObject() + " and update: " + update.getUpdateObject() + " in collecion: " + collectionName);
|
||||
}
|
||||
return execute(collectionName, new CollectionCallback<WriteResult>() {
|
||||
public WriteResult doInCollection(DBCollection collection) throws MongoException, DataAccessException {
|
||||
WriteResult wr = null;
|
||||
@@ -880,7 +886,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
final DBObject queryObject = query.getQueryObject();
|
||||
final PersistentEntity<?> entity = getPersistentEntity(targetClass);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("remove using query: " + queryObject);
|
||||
LOGGER.debug("remove using query: " + queryObject + " in collecion: " + collectionName);
|
||||
}
|
||||
execute(collectionName, new CollectionCallback<Void>() {
|
||||
public Void doInCollection(DBCollection collection) throws MongoException, DataAccessException {
|
||||
@@ -1005,7 +1011,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
protected <T> List<T> doFind(String collectionName, DBObject query, DBObject fields, Class<T> targetClass, CursorPreparer preparer) {
|
||||
PersistentEntity<?> entity = mappingContext.getPersistentEntity(targetClass);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("find using query: " + query + " fields: " + fields + " for class: " + targetClass);
|
||||
LOGGER.debug("find using query: " + query + " fields: " + fields + " for class: " + targetClass + " in collecion: " + collectionName);
|
||||
}
|
||||
return executeEach(new FindCallback(mapper.getMappedObject(query, entity), fields),
|
||||
preparer,
|
||||
@@ -1027,7 +1033,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
*/
|
||||
protected <T> List<T> doFind(String collectionName, DBObject query, DBObject fields, Class<T> targetClass, MongoReader<T> reader) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("find using query: " + query + " fields: " + fields + " for class: " + targetClass);
|
||||
LOGGER.debug("find using query: " + query + " fields: " + fields + " for class: " + targetClass + " in collecion: " + collectionName);
|
||||
}
|
||||
PersistentEntity<?> entity = mappingContext.getPersistentEntity(targetClass);
|
||||
return executeEach(new FindCallback(mapper.getMappedObject(query, entity), fields),
|
||||
@@ -1070,7 +1076,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
|
||||
readerToUse = this.mongoConverter;
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("findAndRemove using query: " + query + " fields: " + fields + " sort: " + sort + " for class: " + targetClass);
|
||||
LOGGER.debug("findAndRemove using query: " + query + " fields: " + fields + " sort: " + sort + " for class: " + targetClass + " in collecion: " + collectionName);
|
||||
}
|
||||
PersistentEntity<?> entity = mappingContext.getPersistentEntity(targetClass);
|
||||
return execute(new FindAndRemoveCallback(mapper.getMappedObject(query, entity), fields, sort),
|
||||
|
||||
Reference in New Issue
Block a user