# logback plugin
* Dependency the toolkit, such as using maven or gradle
```xml
org.apache.skywalking
apm-toolkit-logback-1.x
{project.release.version}
```
* set `%tid` in `Pattern` section of logback.xml
```xml
%d{yyyy-MM-dd HH:mm:ss.SSS} [%tid] [%thread] %-5level %logger{36} -%msg%n
```
* with the MDC, set `%X{tid}` in `Pattern` section of logback.xml
```xml
%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n
```
* Support logback AsyncAppender(MDC also support), No additional configuration is required. Refer to the demo of logback.xml below. For details: [Logback AsyncAppender](https://logback.qos.ch/manual/appenders.html#AsyncAppender)
```xml
%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n
0
1024
true
```
* When you use `-javaagent` to active the sky-walking tracer, logback will output **traceId**, if it existed. If the tracer is inactive, the output will be `TID: N/A`.
# logstash logback plugin
* Dependency the toolkit, such as using maven or gradle
```xml
org.apache.skywalking
apm-toolkit-logback-1.x
${skywalking.version}
```
* set `LogstashEncoder` of logback.xml
```xml
```
* set `LoggingEventCompositeJsonEncoder` of logstash in logback-spring.xml for custom json format
1.add converter for %tid as child of node
```xml
```
2.add json encoder for custom json format
```xml
UTC
{
"level": "%level",
"tid": "%tid",
"thread": "%thread",
"class": "%logger{1.}:%L",
"message": "%message",
"stackTrace": "%exception{10}"
}
```