public final class SourceResolver extends Object implements EventResolver
StackTraceElement returned by LogEvent.getSource().
Note that this resolver is toggled by locationInfoEnabled
layout configuration, which is by default populated from log4j.layout.jsonTemplate.locationInfoEnabled
system property.
config = "field" -> (
"className" |
"fileName" |
"methodName" |
"lineNumber" )
{
"$resolver": "source",
"field": "lineNumber"
}
| Modifier and Type | Method and Description |
|---|---|
boolean |
isResolvable()
Indicates if the resolver if applicable at all.
|
boolean |
isResolvable(LogEvent logEvent)
Indicates if the resolver if applicable for the given
value. |
void |
resolve(LogEvent logEvent,
JsonWriter jsonWriter)
Resolves the given
value using the provided JsonWriter. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisFlattening, resolvepublic boolean isResolvable()
TemplateResolverFor instance, the source line resolver can be short-circuited using this check if the location information is disabled in the layout configuration.
isResolvable in interface TemplateResolver<LogEvent>public boolean isResolvable(LogEvent logEvent)
TemplateResolvervalue.
For instance, the stack trace resolver can be short-circuited using this check if the stack traces are disabled in the layout configuration.
isResolvable in interface TemplateResolver<LogEvent>public void resolve(LogEvent logEvent, JsonWriter jsonWriter)
TemplateResolvervalue using the provided JsonWriter.resolve in interface TemplateResolver<LogEvent>Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.