2 sky walking application toolkit log4j 1.x chn
吴晟 Wu Sheng edited this page 2017-07-08 23:19:29 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

  • 使用 maven 和 gradle 依赖相应的工具包
   <dependency>
      <groupId>org.skywalking</groupId>
      <artifactId>apm-toolkit-log4j-1.x</artifactId>
      <version>{project.release.version}</version>
   </dependency>

    Download

  • 配置layout
log4j.appender.CONSOLE.layout=org.skywalking.apm.toolkit.log.log4j.v1.x.TraceIdPatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d [%T] %-5p %c{1}:%L - %m%n
  • 当你使用-javaagent参数激活sky-walking的探针, 如果当前上下文中存在traceid,log4j将在输出traceId。如果探针没有被激活,将输出TID: N/A.