From 919d6ccb3b1dfe78a06ab4eaf460529cbe61a13d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 7 Feb 2014 17:27:17 +0100 Subject: [PATCH] Actually log the cause of canRead/canWrite failures Issue: SPR-11403 --- .../MappingJackson2MessageConverter.java | 18 +++++++++++++++--- .../MappingJackson2HttpMessageConverter.java | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java index 0051a156cb..12531d2930 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -121,7 +121,13 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter { } Throwable cause = causeRef.get(); if (cause != null) { - logger.warn("Failed to evaluate deserialization for type: " + javaType); + String msg = "Failed to evaluate deserialization for type " + javaType; + if (logger.isDebugEnabled()) { + logger.warn(msg, cause); + } + else { + logger.warn(msg + ": " + cause); + } } return false; } @@ -137,7 +143,13 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter { } Throwable cause = causeRef.get(); if (cause != null) { - logger.warn("Failed to evaluate serialization for type: " + payload.getClass()); + String msg = "Failed to evaluate serialization for type [" + payload.getClass() + "]"; + if (logger.isDebugEnabled()) { + logger.warn(msg, cause); + } + else { + logger.warn(msg + ": " + cause); + } } return false; } diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java index 3a6d4947ee..c3b0d6a5ee 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -165,7 +165,13 @@ public class MappingJackson2HttpMessageConverter extends AbstractHttpMessageConv } Throwable cause = causeRef.get(); if (cause != null) { - logger.warn("Failed to evaluate deserialization for type: " + javaType); + String msg = "Failed to evaluate deserialization for type " + javaType; + if (logger.isDebugEnabled()) { + logger.warn(msg, cause); + } + else { + logger.warn(msg + ": " + cause); + } } return false; } @@ -181,7 +187,13 @@ public class MappingJackson2HttpMessageConverter extends AbstractHttpMessageConv } Throwable cause = causeRef.get(); if (cause != null) { - logger.warn("Failed to evaluate serialization for type: " + clazz); + String msg = "Failed to evaluate serialization for type [" + clazz + "]"; + if (logger.isDebugEnabled()) { + logger.warn(msg, cause); + } + else { + logger.warn(msg + ": " + cause); + } } return false; }