DATAMONGO-2224 - Add trace logging to DBRef resolution.
We added trace logging to DefaultDbRefResolver.
<logger name="org.springframework.data.mongodb.core.convert.DefaultDbRefResolver" level="trace"/>
Original pull request: #659.
pull/792/head
Christoph Strobl7 years agocommitted byMark Paluch
@ -110,6 +114,12 @@ public class DefaultDbRefResolver implements DbRefResolver {
@@ -110,6 +114,12 @@ public class DefaultDbRefResolver implements DbRefResolver {
@Override
publicDocumentfetch(DBRefdbRef){
if(LOGGER.isTraceEnabled()){
LOGGER.trace("Fetching DBRef '{}' from {}.{}.",dbRef.getId(),
@ -141,7 +151,16 @@ public class DefaultDbRefResolver implements DbRefResolver {
@@ -141,7 +151,16 @@ public class DefaultDbRefResolver implements DbRefResolver {
@ -438,26 +457,34 @@ public class DefaultDbRefResolver implements DbRefResolver {
@@ -438,26 +457,34 @@ public class DefaultDbRefResolver implements DbRefResolver {
@ -593,6 +593,9 @@ IMPORTANT: The mapping framework does not handle cascading saves. If you change
@@ -593,6 +593,9 @@ IMPORTANT: The mapping framework does not handle cascading saves. If you change
``DBRef``s can also be resolved lazily. In this case the actual `Object` or `Collection` of references is resolved on first access of the property. Use the `lazy` attribute of `@DBRef` to specify this.
Required properties that are also defined as lazy loading ``DBRef`` and used as constructor arguments are also decorated with the lazy loading proxy making sure to put as little pressure on the database and network as possible.
TIP: Lazily loaded ``DBRef``s can be hard to debug. Make sure tooling does not accidentally trigger proxy resolution by eg. calling `toString()` or some inline debug rendering invoking property getters.
Please consider to enable _trace_ logging for `org.springframework.data.mongodb.core.convert.DefaultDbRefResolver` to gain insight on `DBRef` resolution.