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 2020/06/29 06:30:29 UTC
[GitHub] [skywalking] cnhaicao opened a new issue #4983: Spring cloud gateway project logback cannot print TraceID
cnhaicao opened a new issue #4983:
URL: https://github.com/apache/skywalking/issues/4983
spring cloud gateway 2.1.X
pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
</dependency>
logback configuration:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_FILE" value="./logs/gateway-logs/gateway.log"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<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>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>104857600</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<MaxHistory>10</MaxHistory>
</rollingPolicy>
<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>
</appender>
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</configuration>
LOG INFO IS :
The logback log TraceID has always been: [TID:N/A]
----------------------------------------------------------------
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
[GitHub] [skywalking] wu-sheng commented on issue #4983: Spring cloud gateway project logback cannot print TraceID
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #4983:
URL: https://github.com/apache/skywalking/issues/4983#issuecomment-650954486
We didn't test and guarantee that right now. This feature used to print the id in your app business code only.
Gateway has many async thread case, if you want to do this, you have to understand the tracing context and Gateway thread mode very clear.
----------------------------------------------------------------
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
[GitHub] [skywalking] ldy commented on issue #4983: Spring cloud gateway project logback cannot print TraceID
Posted by GitBox <gi...@apache.org>.
ldy commented on issue #4983:
URL: https://github.com/apache/skywalking/issues/4983#issuecomment-734287899
below is my project lib version:
SpringBoot:2.1.4.RELEASE,Spring Cloud Gateway:2.1.2,apm-toolkit-logback-1.x:6.5.0,Skywalking:8.2.0
I met the same problem too!
In gateway service,i can print the tid in my code when i use ```String traceId = TraceContext.traceId();```,but logback cannot print tid,only show ```[TID:N/A]```.
In other service,logback can also print tid normal.
what can i do to let logback to print tid normal in gateway service?

----------------------------------------------------------------
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
[GitHub] [skywalking] wu-sheng closed issue #4983: Spring cloud gateway project logback cannot print TraceID
Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #4983:
URL: https://github.com/apache/skywalking/issues/4983
----------------------------------------------------------------
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