zhaoyuguang commented on a change in pull request #2750: Logback support 
AsyncAppender print tid
URL: https://github.com/apache/skywalking/pull/2750#discussion_r298980236
 
 

 ##########
 File path: 
apm-sniffer/apm-toolkit-activation/apm-toolkit-logback-1.x-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/log/logback/v1/x/mdc/PrintMDCTraceIdInterceptor.java
 ##########
 @@ -36,7 +36,11 @@
 
     @Override public Object afterMethod(EnhancedInstance objInst, Method 
method, Object[] allArguments,
         Class<?>[] argumentsTypes, Object ret) throws Throwable {
-        return "TID:" + ContextManager.getGlobalTraceId();
+        String tid = ContextManager.getGlobalTraceId();
+        if ("N/A".equals(tid)) {
+            tid = (String) ((EnhancedInstance) 
allArguments[0]).getSkyWalkingDynamicField();
+        }
 
 Review comment:
   Sorry, I forgot to update here, this is what we discussed at the time, 
because objInst is an interface, there may be multiple implementations, but we 
just enhanced `ch.qos.logback.classic.spi.LoggingEvent`, so use `ContextManager 
.isActive()` is true must be synchronous, when there is no trace, the 
speculative asynchronous decision logic

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to