Files
peipei-backend/play-common/src/main/java/com/starry/common/config/LoggingConfig.java
irving b96fdc6427 feat: 增强日志系统和请求追踪功能
- 新增CorrelationFilter过滤器,为每个请求生成唯一跟踪ID
- 增强logback配置,支持关联ID、租户信息和用户ID的结构化日志
- 新增RequestLoggingInterceptor,记录详细的HTTP请求响应信息
2025-09-06 20:30:13 -04:00

42 lines
1.3 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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"
);
}
}