public class LogContext extends Object
Utility class to manage log data with MDC. This class allows MDC parameters to be set, and popped back off when the context is finished.
| Constructor and Description |
|---|
LogContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
finish()
Finish the context.
|
void |
put(String key,
String value)
Set a key in the MDC environment.
|
public void put(String key, String value)
Set a key in the MDC environment.
key - The key to set.value - The key’s value.MDC.put(String, String)public void finish()
Finish the context. This restores the MDC context map to the value it had when the log context was created.