public class OddjobNDC extends java.lang.Object implements LoggingConstants
It is very crude wrapper for the Log4j MDC class. One day it would be nice to work out how to apply this to other logging utilities.
Note that this is a thread based nested diagnostic context that does not interfere with Log4j's own. It populates log4j's mapped diagnostic context instead.
Modifier and Type | Class and Description |
---|---|
static class |
OddjobNDC.LogContext
Holds Logger and Job information for the Stack.
|
MDC_JOB_NAME, MDC_LEVEL_PADDING, MDC_LOGGER
Modifier and Type | Method and Description |
---|---|
static java.util.Optional<OddjobNDC.LogContext> |
current()
Looks at the last diagnostic context at the top of this NDC without
removing it.
|
static Restore |
push(java.lang.String loggerName,
java.lang.Object job)
Push new diagnostic context information for the current thread.
|
static Restore |
setLoggingNDC(OddjobNDC.LogContext ndcs) |
public static java.util.Optional<OddjobNDC.LogContext> current()
The returned value is the value that was pushed last. If no context is available, then null is returned.
public static Restore push(java.lang.String loggerName, java.lang.Object job)
loggerName
- The new diagnostic context information.public static Restore setLoggingNDC(OddjobNDC.LogContext ndcs)