ttl
ttl源码
log4j2-PatternLayout
PatternLayout
实现
jvm增加启动参数:
-javaagent:path/to/transmittable-thread-local-2.x.y.jar
援用maven:
<!-- because this dependency is implemented by log4j2 runtime extension that will never be used by biz code, set scope to *runtime*.--><dependency> <groupId>com.alibaba</groupId> <artifactId>log4j2-ttl-thread-context-map</artifactId> <version>1.3.3</version> <scope>runtime</scope></dependency>
log4j2 xml配置:[%X{traceId}]
log4j2 新增properties配置文件log4j2.component.properties,内容:
log4j2.threadContextMap=com.alibaba.ttl.log4j2.TtlThreadContextMap