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 2021/03/18 11:19:36 UTC

[GitHub] [skywalking] xuanyu66 commented on a change in pull request #6567: fix no trace id in async log

xuanyu66 commented on a change in pull request #6567:
URL: https://github.com/apache/skywalking/pull/6567#discussion_r596763629



##########
File path: apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-2.x-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/log/log4j/v2/x/async/AsyncAppenderMethodInterceptor.java
##########
@@ -32,7 +32,9 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
         MethodInterceptResult result) throws Throwable {
         if (allArguments[0] instanceof EnhancedInstance) {
             EnhancedInstance instances = (EnhancedInstance) allArguments[0];
-            instances.setSkyWalkingDynamicField(ContextManager.getGlobalTraceId());
+            if (instances.getSkyWalkingDynamicField() == null){
+                instances.setSkyWalkingDynamicField(ContextManager.getGlobalTraceId());

Review comment:
       In our scenario , We remove AsyncAppenderInstrumentation and AsyncLoggerConfigInstrumentation, and the plugin works well.
   But if I remove them in open source code, I'am not sure it will break others' code.
   So I decide to keep the code, and make it compatible




----------------------------------------------------------------
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