Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ThreadContext.put() and MDC.Put()?

I just want to know the difference between threadContext.put and MDC.put.Because, i believe that both are doing the same operation.

like image 791
RathanaKumar Avatar asked Dec 31 '19 06:12

RathanaKumar


1 Answers

Log4j 2 continues with the idea of the MDC and the NDC but merges them into a single Thread Context. The Thread Context Map is the equivalent of the MDC and the Thread Context Stack is the equivalent of the NDC. Although these are frequently used for purposes other than diagnosing problems, they are still frequently referred to as the MDC and NDC in Log4j 2 since they are already well known by those acronyms.

https://logging.apache.org/log4j/2.x/manual/thread-context.html

like image 105
Saurav Kumar Singh Avatar answered Sep 27 '22 19:09

Saurav Kumar Singh