File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
spring-webmvc/src/main/java/org/springframework/web/servlet/handler Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 78
78
public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
79
79
implements HandlerMapping , Ordered , BeanNameAware {
80
80
81
+ final static String SUPPRESS_LOGGING_ATTRIBUTE = AbstractHandlerMapping .class .getName () + ".SUPPRESS_LOGGING" ;
82
+
83
+
81
84
/** Dedicated "hidden" logger for request mappings. */
82
85
protected final Log mappingsLogger =
83
86
LogDelegateFactory .getHiddenLog (HandlerMapping .class .getName () + ".Mappings" );
@@ -520,11 +523,13 @@ public final HandlerExecutionChain getHandler(HttpServletRequest request) throws
520
523
521
524
HandlerExecutionChain executionChain = getHandlerExecutionChain (handler , request );
522
525
523
- if (logger .isTraceEnabled ()) {
524
- logger .trace ("Mapped to " + handler );
525
- }
526
- else if (logger .isDebugEnabled () && !DispatcherType .ASYNC .equals (request .getDispatcherType ())) {
527
- logger .debug ("Mapped to " + executionChain .getHandler ());
526
+ if (request .getAttribute (SUPPRESS_LOGGING_ATTRIBUTE ) == null ) {
527
+ if (logger .isTraceEnabled ()) {
528
+ logger .trace ("Mapped to " + handler );
529
+ }
530
+ else if (logger .isDebugEnabled () && !DispatcherType .ASYNC .equals (request .getDispatcherType ())) {
531
+ logger .debug ("Mapped to " + executionChain .getHandler ());
532
+ }
528
533
}
529
534
530
535
if (hasCorsConfigurationSource (handler ) || CorsUtils .isPreFlightRequest (request )) {
Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ private static class AttributesPreservingRequest extends HttpServletRequestWrapp
261
261
AttributesPreservingRequest (HttpServletRequest request ) {
262
262
super (request );
263
263
this .attributes = initAttributes (request );
264
+ this .attributes .put (AbstractHandlerMapping .SUPPRESS_LOGGING_ATTRIBUTE , Boolean .TRUE );
264
265
}
265
266
266
267
private Map <String , Object > initAttributes (HttpServletRequest request ) {
You can’t perform that action at this time.
0 commit comments