Shuning Wan
Shuning Wan
你如果用到了 tlog-web-spring-boot-starter 这个引入方式, TLog默认使用的是TLogWebInterceptor拦截器操作TLogContext上下文信息,因为过滤器前置是先于拦截器前置执行的,所以过滤器链调用前置操作的log输出打印不出来,对于过滤器链调用后置操作的log是因为过滤器的后置是晚于拦截器的后置执行的,已经被TLogWebInterceptor后置操作清除了,所以也打印不出来,这个是实现机制导致的,有三种解决办法: 1. 将自己的Filter使用Interceptor替换,并晚于TLogWebInterceptor执行 2. 启动类屏蔽TLogWebInterceptor的注册,同时启用 TLogServletFilter,需要确保TLogServletFilter先执行 ```text @SpringBootApplication(exclude = {TLogWebAutoConfiguration.class}) ``` ``` package com.example.demo; import com.yomahub.tlog.web.filter.TLogServletFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.servlet.Filter; @Configuration public class...