Class ThreadContextDataResolver
- java.lang.Object
-
- org.apache.logging.log4j.layout.template.json.resolver.ThreadContextDataResolver
-
- All Implemented Interfaces:
EventResolver
,TemplateResolver<LogEvent>
public final class ThreadContextDataResolver extends Object
Mapped Diagnostic Context (MDC), aka. Thread Context Data, resolver.- See Also:
ReadOnlyStringMapResolver
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isFlattening()
Indicates if the resolution should be appended to the parent JSON object.boolean
isResolvable(LogEvent logEvent)
Indicates if the resolver if applicable for the givenvalue
.void
resolve(LogEvent logEvent, JsonWriter jsonWriter)
Resolves the givenvalue
using the providedJsonWriter
.void
resolve(LogEvent logEvent, JsonWriter jsonWriter, boolean succeedingEntry)
Resolves the givenvalue
using the providedJsonWriter
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.layout.template.json.resolver.TemplateResolver
isResolvable
-
-
-
-
Method Detail
-
isFlattening
public boolean isFlattening()
Description copied from interface:TemplateResolver
Indicates if the resolution should be appended to the parent JSON object.For instance,
ThreadContextDataResolver
, i.e., MDC resolver, uses this flag to indicate whether the contents should be appended to the parent JSON object or not.- Specified by:
isFlattening
in interfaceTemplateResolver<LogEvent>
-
isResolvable
public boolean isResolvable(LogEvent logEvent)
Description copied from interface:TemplateResolver
Indicates if the resolver if applicable for the givenvalue
.For instance, the stack trace resolver can be short-circuited using this check if the stack traces are disabled in the layout configuration.
- Specified by:
isResolvable
in interfaceTemplateResolver<LogEvent>
-
resolve
public void resolve(LogEvent logEvent, JsonWriter jsonWriter)
Description copied from interface:TemplateResolver
Resolves the givenvalue
using the providedJsonWriter
.- Specified by:
resolve
in interfaceTemplateResolver<LogEvent>
-
resolve
public void resolve(LogEvent logEvent, JsonWriter jsonWriter, boolean succeedingEntry)
Description copied from interface:TemplateResolver
Resolves the givenvalue
using the providedJsonWriter
.- Specified by:
resolve
in interfaceTemplateResolver<LogEvent>
succeedingEntry
- false, if this is the first element in a collection; true, otherwise
-
-