Debug-level log entry for any Jackson exception during canConvert
Issue: SPR-15582
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -178,10 +178,20 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter {
|
||||
* @since 4.3
|
||||
*/
|
||||
protected void logWarningIfNecessary(Type type, 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" : "") +
|
||||
"serialization for type [" + type + "]";
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (debugLevel) {
|
||||
logger.debug(msg, cause);
|
||||
}
|
||||
else if (logger.isDebugEnabled()) {
|
||||
logger.warn(msg, cause);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user