Logging - Context (Mapped Diagnostic Context)

Java Conceptuel Diagram

About

Context data (also known as Mapped Diagnostic Context or MDC)

To be able to follow a request that flow in different component, you need to put the request ID in every message (generally a GUID.

It's a mechanism to insert key-value pairs in log messages.

It can also be highly helpful in filtering messages or triggering certain actions.

Component

Example

MDC.put("requestId", "xxxx-XXXX-xxxx");





Discover More
Java Conceptuel Diagram
Log4j - How to route message to log file created dynamically

How to route message to file created dynamically. This is already embedded in the core log4j functionality when you combine: RoutingAppender...



Share this page:
Follow us:
Task Runner