You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/12/06 08:08:44 UTC
[GitHub] [skywalking] gonedays opened a new issue #4016: How to integrate
with logstash-logback-encoder in json format
gonedays opened a new issue #4016: How to integrate with logstash-logback-encoder in json format
URL: https://github.com/apache/skywalking/issues/4016
Please answer these questions before submitting your issue.
- Why do you submit this issue?
- [x] Question or discussion
- [ ] Bug
- [ ] Requirement
- [ ] Feature or performance improvement
___
### Question
- What do you want to know?
We use logstash-logback-encoder in custom json format, but failed to print TID in log file.
___
### Bug
- Which version of SkyWalking, OS and JRE?
SkyWalking: 6.5.0
OS: linux or windows
JRE: JDK8
logback-core: 1.1.11
- Which company or project?
test
- What happen?
If possible, provide a way for reproducing the error. e.g. demo application, component version.
1. Add dependency in maven pom.xml
` <dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>6.5.0</version>
</dependency>`
2. config logback xml
` <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<mdc/>
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
<provider class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.logstash.TraceIdJsonProvider"/>
<pattern>
<pattern>
{
"level": "%level",
"ip": "${IP}",
"service": "${APP_NAME:-}",
"trace": "%X{X-B3-TraceId:-}",
"TID": "%X{TID}",
"tid": "%X{tid}",
"span": "%X{X-B3-SpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{1.}:%L",
"message": "%message",
"stackTrace": "%exception{10}"
}
</pattern>
</pattern>
</providers>
</encoder>`
3. No TID in log file.
With above configuration, faield to print TID, but with below configuration, it works:
` <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level logger_name:%logger{36} - [%tid] - message:%msg%n</pattern>
</layout>
</encoder>`
Please help how to handle it. Appreciate your help.
___
### Requirement or improvement
- Please describe about your requirements or improvement suggestions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services