TLog
TLog copied to clipboard
xxl-job集成,多个job任务或单个任务多次请求 traceId一直一样
使用的tlog版本是1.3.3
使用的tlog版本是1.3.3
因为xxl-job使用线程池调度,所以会有重复问题。我的解决方案是用spring切面处理。
@Component
@Aspect
public class TLogXxlJobHandlerAspect {
private TLogRPCHandler tLogRPCHandler = new TLogRPCHandler();
@Pointcut("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public void xxlJobHandlerAspect() {}
@Before("xxlJobHandlerAspect()")
public void doBefore() {
tLogRPCHandler.processProviderSide(new TLogLabelBean());
}
@After("xxlJobHandlerAspect()")
public void doAfter() {
tLogRPCHandler.cleanThreadLocal();
}
}
