diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java index d8ad0326..4b01f27f 100644 --- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java +++ b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/autoconfigure/LogAutoConfiguration.java @@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import top.continew.starter.core.constant.StringConstants; import top.continew.starter.log.annotation.ConditionalOnEnabledLog; import top.continew.starter.log.dao.LogDao; import top.continew.starter.log.dao.impl.DefaultLogDaoImpl; @@ -56,7 +57,9 @@ public class LogAutoConfiguration implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(new LogInterceptor(logProperties, logHandler(), logDao())); + registry.addInterceptor(new LogInterceptor(logProperties, logHandler(), logDao())) + .addPathPatterns(StringConstants.PATH_PATTERN) + .excludePathPatterns(logProperties.getExcludePatterns()); } /** diff --git a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/LogInterceptor.java b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/LogInterceptor.java index 23ad0e34..f02b1ae7 100644 --- a/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/LogInterceptor.java +++ b/continew-starter-log/continew-starter-log-interceptor/src/main/java/top/continew/starter/log/interceptor/LogInterceptor.java @@ -109,10 +109,6 @@ public class LogInterceptor implements HandlerInterceptor { if (!(handler instanceof HandlerMethod handlerMethod)) { return false; } - // 如果接口匹配排除列表,不记录日志 - if (logProperties.isMatch(request.getRequestURI())) { - return false; - } // 如果接口被隐藏,不记录日志 Operation methodOperation = handlerMethod.getMethodAnnotation(Operation.class); if (null != methodOperation && methodOperation.hidden()) {