@@ -1007,8 +1007,8 @@ public WriteResult doInCollection(DBCollection collection) throws MongoException
1007
1007
update .getUpdateObject (), entity );
1008
1008
1009
1009
if (LOGGER .isDebugEnabled ()) {
1010
- LOGGER .debug ("Calling update using query: " + queryObj + " and update: " + updateObj + " in collection: "
1011
- + collectionName );
1010
+ LOGGER .debug (String . format ( "Calling update using query: %s and update: %s in collection: %s" ,
1011
+ serializeToJsonSafely ( queryObj ), serializeToJsonSafely ( updateObj ), collectionName ) );
1012
1012
}
1013
1013
1014
1014
MongoAction mongoAction = new MongoAction (writeConcern , MongoActionOperation .UPDATE , collectionName ,
@@ -1187,7 +1187,8 @@ public WriteResult doInCollection(DBCollection collection) throws MongoException
1187
1187
WriteConcern writeConcernToUse = prepareWriteConcern (mongoAction );
1188
1188
1189
1189
if (LOGGER .isDebugEnabled ()) {
1190
- LOGGER .debug ("Remove using query: {} in collection: {}." , new Object [] { dboq , collection .getName () });
1190
+ LOGGER .debug ("Remove using query: {} in collection: {}." ,
1191
+ new Object [] { serializeToJsonSafely (dboq ), collection .getName () });
1191
1192
}
1192
1193
1193
1194
WriteResult wr = writeConcernToUse == null ? collection .remove (dboq ) : collection .remove (dboq ,
@@ -1644,8 +1645,8 @@ protected <T> T doFindAndRemove(String collectionName, DBObject query, DBObject
1644
1645
Class <T > entityClass ) {
1645
1646
EntityReader <? super T , DBObject > readerToUse = this .mongoConverter ;
1646
1647
if (LOGGER .isDebugEnabled ()) {
1647
- LOGGER .debug ("findAndRemove using query: " + query + " fields: " + fields + " sort: " + sort + " for class: "
1648
- + entityClass + " in collection: " + collectionName );
1648
+ LOGGER .debug (String . format ( "findAndRemove using query: %s fields: %s sort: %s for class: %s in collection: %s" ,
1649
+ serializeToJsonSafely ( query ), fields , sort , entityClass , collectionName ) );
1649
1650
}
1650
1651
MongoPersistentEntity <?> entity = mappingContext .getPersistentEntity (entityClass );
1651
1652
return executeFindOneInternal (new FindAndRemoveCallback (queryMapper .getMappedObject (query , entity ), fields , sort ),
@@ -1669,8 +1670,9 @@ protected <T> T doFindAndModify(String collectionName, DBObject query, DBObject
1669
1670
DBObject mappedUpdate = updateMapper .getMappedObject (update .getUpdateObject (), entity );
1670
1671
1671
1672
if (LOGGER .isDebugEnabled ()) {
1672
- LOGGER .debug ("findAndModify using query: " + mappedQuery + " fields: " + fields + " sort: " + sort
1673
- + " for class: " + entityClass + " and update: " + mappedUpdate + " in collection: " + collectionName );
1673
+ LOGGER .debug (String .format ("findAndModify using query: %s fields: %s sort: %s for class: %s and update: %s " +
1674
+ "in collection: %s" , serializeToJsonSafely (mappedQuery ), fields , sort , entityClass ,
1675
+ serializeToJsonSafely (mappedUpdate ), collectionName ));
1674
1676
}
1675
1677
1676
1678
return executeFindOneInternal (new FindAndModifyCallback (mappedQuery , fields , sort , mappedUpdate , options ),
@@ -1980,13 +1982,14 @@ public FindOneCallback(DBObject query, DBObject fields) {
1980
1982
public DBObject doInCollection (DBCollection collection ) throws MongoException , DataAccessException {
1981
1983
if (fields == null ) {
1982
1984
if (LOGGER .isDebugEnabled ()) {
1983
- LOGGER .debug ("findOne using query: " + query + " in db.collection: " + collection .getFullName ());
1985
+ LOGGER .debug (String .format ("findOne using query: %s in db.collection: %s" ,
1986
+ serializeToJsonSafely (query ), collection .getFullName ()));
1984
1987
}
1985
1988
return collection .findOne (query );
1986
1989
} else {
1987
1990
if (LOGGER .isDebugEnabled ()) {
1988
- LOGGER .debug ("findOne using query: " + query + " fields: " + fields + " in db.collection: "
1989
- + collection .getFullName ());
1991
+ LOGGER .debug (String . format ( "findOne using query: %s fields: %s in db.collection: %s" ,
1992
+ serializeToJsonSafely ( query ), fields , collection .getFullName () ));
1990
1993
}
1991
1994
return collection .findOne (query , fields );
1992
1995
}
0 commit comments