Suppress handler mapping logging for introspector
Closes gh-30349
This commit is contained in:
parent
2530efd1c7
commit
0f7c406a86
|
@ -78,6 +78,9 @@ import org.springframework.web.util.pattern.PathPatternParser;
|
|||
public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
||||
implements HandlerMapping, Ordered, BeanNameAware {
|
||||
|
||||
final static String SUPPRESS_LOGGING_ATTRIBUTE = AbstractHandlerMapping.class.getName() + ".SUPPRESS_LOGGING";
|
||||
|
||||
|
||||
/** Dedicated "hidden" logger for request mappings. */
|
||||
protected final Log mappingsLogger =
|
||||
LogDelegateFactory.getHiddenLog(HandlerMapping.class.getName() + ".Mappings");
|
||||
|
@ -520,11 +523,13 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||
|
||||
HandlerExecutionChain executionChain = getHandlerExecutionChain(handler, request);
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Mapped to " + handler);
|
||||
}
|
||||
else if (logger.isDebugEnabled() && !DispatcherType.ASYNC.equals(request.getDispatcherType())) {
|
||||
logger.debug("Mapped to " + executionChain.getHandler());
|
||||
if (request.getAttribute(SUPPRESS_LOGGING_ATTRIBUTE) == null) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Mapped to " + handler);
|
||||
}
|
||||
else if (logger.isDebugEnabled() && !DispatcherType.ASYNC.equals(request.getDispatcherType())) {
|
||||
logger.debug("Mapped to " + executionChain.getHandler());
|
||||
}
|
||||
}
|
||||
|
||||
if (hasCorsConfigurationSource(handler) || CorsUtils.isPreFlightRequest(request)) {
|
||||
|
|
|
@ -261,6 +261,7 @@ public class HandlerMappingIntrospector
|
|||
AttributesPreservingRequest(HttpServletRequest request) {
|
||||
super(request);
|
||||
this.attributes = initAttributes(request);
|
||||
this.attributes.put(AbstractHandlerMapping.SUPPRESS_LOGGING_ATTRIBUTE, Boolean.TRUE);
|
||||
}
|
||||
|
||||
private Map<String, Object> initAttributes(HttpServletRequest request) {
|
||||
|
|
Loading…
Reference in New Issue