feat: 增强日志系统和请求追踪功能
- 新增CorrelationFilter过滤器,为每个请求生成唯一跟踪ID - 增强logback配置,支持关联ID、租户信息和用户ID的结构化日志 - 新增RequestLoggingInterceptor,记录详细的HTTP请求响应信息
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.starry.common.config;
|
||||
|
||||
import com.starry.common.interceptor.RequestLoggingInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 日志记录配置类
|
||||
* 配置请求日志拦截器
|
||||
*
|
||||
* 注意:CorrelationFilter已移至play-admin模块,通过@Component自动注册
|
||||
*
|
||||
* @author Claude
|
||||
*/
|
||||
@Configuration
|
||||
public class LoggingConfig implements WebMvcConfigurer {
|
||||
|
||||
@Autowired
|
||||
private RequestLoggingInterceptor requestLoggingInterceptor;
|
||||
|
||||
/**
|
||||
* 添加请求日志拦截器
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(requestLoggingInterceptor)
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns(
|
||||
"/static/**",
|
||||
"/webjars/**",
|
||||
"/swagger-resources/**",
|
||||
"/v2/api-docs/**",
|
||||
"/swagger-ui.html/**",
|
||||
"/doc.html/**",
|
||||
"/error",
|
||||
"/favicon.ico"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user