Skip to content

Commit 691a4e1

Browse files
fix: do not log status requests in PathRequestLoggingFilter
1 parent 0b36633 commit 691a4e1

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

mdx-web/src/main/java/com/mx/path/model/mdx/web/filter/PathRequestLoggingFilter.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ protected final void doFilterInternal(HttpServletRequest request, HttpServletRes
7474
// Pass request to next filter with wrappers to support logging request and response bodies
7575
filterChain.doFilter(requestWrapper, responseWrapper);
7676
} finally {
77-
try {
78-
this.logRequest(requestWrapper, responseWrapper, requestStartTimeMillis);
79-
} catch (Exception ex) {
80-
MDC.put("exception", LoggingExceptionFormatter.formatLoggingExceptionWithStacktrace(ex));
81-
logger.error("Failed to log incoming request", ex);
82-
} finally {
83-
resetMDC();
77+
if (!request.getRequestURI().contains("/status")) {
78+
try {
79+
this.logRequest(requestWrapper, responseWrapper, requestStartTimeMillis);
80+
} catch (Exception ex) {
81+
MDC.put("exception", LoggingExceptionFormatter.formatLoggingExceptionWithStacktrace(ex));
82+
logger.error("Failed to log incoming request", ex);
83+
} finally {
84+
resetMDC();
85+
}
8486
}
8587

8688
responseWrapper.copyBodyToResponse();

0 commit comments

Comments
 (0)