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 2018/12/06 04:50:45 UTC

[GitHub] ASCE1885 commented on issue #1997: Print traceId to log4j2 failed

ASCE1885 commented on issue #1997: Print traceId to log4j2 failed
URL: https://github.com/apache/incubator-skywalking/issues/1997#issuecomment-444747585
 
 
   @wu-sheng I enhanced `org.apache.logging.log4j.ThreadContext`  and intercept method `getImmutableContext` and `getContext`,before this two method called,I printed `traceid` to mdc. In this way,it both supports sync and async mode of log4j2.
   
   ```java
   @Override
   public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
           ThreadContext.put("SW-", "TID:" + ContextManager.getGlobalTraceId());
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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