Debug-level log entry for any Jackson exception during canConvert
Issue: SPR-15582
This commit is contained in:
@@ -180,10 +180,20 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter {
|
|||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
|
protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
|
||||||
if (cause != null && !(cause instanceof JsonMappingException && cause.getMessage().startsWith("Can not find"))) {
|
if (cause == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean debugLevel = (cause instanceof JsonMappingException &&
|
||||||
|
cause.getMessage().startsWith("Can not find"));
|
||||||
|
|
||||||
|
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
|
||||||
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +
|
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +
|
||||||
"serialization for type [" + type + "]";
|
"serialization for type [" + type + "]";
|
||||||
if (logger.isDebugEnabled()) {
|
if (debugLevel) {
|
||||||
|
logger.debug(msg, cause);
|
||||||
|
}
|
||||||
|
else if (logger.isDebugEnabled()) {
|
||||||
logger.warn(msg, cause);
|
logger.warn(msg, cause);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -191,10 +191,20 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
|||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
|
protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
|
||||||
if (cause != null && !(cause instanceof JsonMappingException && cause.getMessage().startsWith("Can not find"))) {
|
if (cause == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean debugLevel = (cause instanceof JsonMappingException &&
|
||||||
|
cause.getMessage().startsWith("Can not find"));
|
||||||
|
|
||||||
|
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
|
||||||
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +
|
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +
|
||||||
"serialization for type [" + type + "]";
|
"serialization for type [" + type + "]";
|
||||||
if (logger.isDebugEnabled()) {
|
if (debugLevel) {
|
||||||
|
logger.debug(msg, cause);
|
||||||
|
}
|
||||||
|
else if (logger.isDebugEnabled()) {
|
||||||
logger.warn(msg, cause);
|
logger.warn(msg, cause);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user