logging - What is the difference between Log4j's NDC and MDC facilities? - Stack Overflow
MDC allows you to add custom tags for log4j. eg:
%X{mytag} in log4j.xml
is referenced by
MDC.put("mytag","StackOverflow");
MDC child thread automatically inherits a copy of the mapped diagnostic context of its parent.
NDC operations such as push
, pop
, clear
, getDepth
and setMaxDepth
affect the NDC of the current thread only.
Read full article from logging - What is the difference between Log4j's NDC and MDC facilities? - Stack Overflow
No comments:
Post a Comment