* Dependency the toolkit, such as using maven or gradle ```xml org.apache.skywalking apm-toolkit-log4j-1.x {project.release.version} ``` * Config a layout ```properties log4j.appender.CONSOLE.layout=TraceIdPatternLayout ``` * set `%T` in `layout.ConversionPattern` ( In 2.0-2016, you should use %x, [Why change?](https://github.com/wu-sheng/sky-walking/issues/77) ) ```properties log4j.appender.CONSOLE.layout.ConversionPattern=%d [%T] %-5p %c{1}:%L - %m%n ``` * When you use `-javaagent` to active the sky-walking tracer, log4j will output **traceId**, if it existed. If the tracer is inactive, the output will be `TID: N/A`.