Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 907 Bytes

Application-toolkit-logback-1.x.md

File metadata and controls

21 lines (19 loc) · 907 Bytes
  • Dependency the toolkit, such as using maven or gradle
   <dependency>
      <groupId>org.apache.skywalking</groupId>
      <artifactId>skywalking-toolkit-logback-1.x</artifactId>
      <version>{project.release.version}</version>
   </dependency>
  • set %tid in Pattern section of logback.xml
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="com.a.eye.skywalking.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%tid] [%thread] %-5level %logger{36} -%msg%n</Pattern>
            </layout>
        </encoder>
    </appender>
  • When you use -javaagent to active the sky-waking tracer, logback will output traceId, if it existed. If the tracer is inactive, the output will be TID: N/A.