From a07c142f438c9c01529a27b7f4da4af99514cea2 Mon Sep 17 00:00:00 2001
From: huangxz <huangxz@xiaopeng.com>
Date: 星期六, 07 三月 2026 21:00:29 +0800
Subject: [PATCH] feat: 添加请求/响应日志过滤器和日志拦截器

---
 xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/config/WebMvcConfigurer.java |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/config/WebMvcConfigurer.java b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/config/WebMvcConfigurer.java
index 2c179cc..afe4be8 100644
--- a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/config/WebMvcConfigurer.java
+++ b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/config/WebMvcConfigurer.java
@@ -1,6 +1,6 @@
 package com.xiaopeng.automaticPilot.config;
 
-
+import com.xiaopeng.automaticPilot.interceptor.LogInterceptor;
 import com.xiaopeng.unifiedverification.interceptor.CheckForClientInterceptor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,11 +13,16 @@
 public class WebMvcConfigurer implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer {
 
     @Autowired
+    private LogInterceptor logInterceptor;
+
+    @Autowired
     @Lazy
     private CheckForClientInterceptor checkForClientInterceptor;
 
     @Override
     public void addInterceptors(InterceptorRegistry registry) {
+        // 日志拦截器,拦截所有请求,初始化 MDC(traceId、IP、URI)
+        registry.addInterceptor(logInterceptor).addPathPatterns("/**");
         // 统一验证服务拦截器
         registry.addInterceptor(checkForClientInterceptor).addPathPatterns("/vehicle/v1/**");
     }

--
Gitblit v1.7.1