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 booleanisFlattening()Indicates if the resolution should be appended to the parent JSON object.booleanisResolvable(LogEvent logEvent)Indicates if the resolver if applicable for the givenvalue.voidresolve(LogEvent logEvent, JsonWriter jsonWriter)Resolves the givenvalueusing the providedJsonWriter.voidresolve(LogEvent logEvent, JsonWriter jsonWriter, boolean succeedingEntry)Resolves the givenvalueusing 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:TemplateResolverIndicates 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:
isFlatteningin interfaceTemplateResolver<LogEvent>
-
isResolvable
public boolean isResolvable(LogEvent logEvent)
Description copied from interface:TemplateResolverIndicates 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:
isResolvablein interfaceTemplateResolver<LogEvent>
-
resolve
public void resolve(LogEvent logEvent, JsonWriter jsonWriter)
Description copied from interface:TemplateResolverResolves the givenvalueusing the providedJsonWriter.- Specified by:
resolvein interfaceTemplateResolver<LogEvent>
-
resolve
public void resolve(LogEvent logEvent, JsonWriter jsonWriter, boolean succeedingEntry)
Description copied from interface:TemplateResolverResolves the givenvalueusing the providedJsonWriter.- Specified by:
resolvein interfaceTemplateResolver<LogEvent>succeedingEntry- false, if this is the first element in a collection; true, otherwise
-
-