Class OpenTelemetryAppender.Builder<B extends OpenTelemetryAppender.Builder<B>>
java.lang.Object
org.apache.logging.log4j.core.filter.AbstractFilterable.Builder<B>
org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B>
io.opentelemetry.instrumentation.log4j.appender.v2_17.OpenTelemetryAppender.Builder<B>
- All Implemented Interfaces:
org.apache.logging.log4j.core.util.Builder<OpenTelemetryAppender>
- Enclosing class:
OpenTelemetryAppender
public static class OpenTelemetryAppender.Builder<B extends OpenTelemetryAppender.Builder<B>>
extends org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B>
implements org.apache.logging.log4j.core.util.Builder<OpenTelemetryAppender>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()captureCodeAttributes(boolean captureCodeAttributes) Sets whether the code attributes (file name, class name, method name and line number) should be set to logs.setCaptureContextDataAttributes(String captureContextDataAttributes) Configures theThreadContextattributes that will be copied to logs.setCaptureExperimentalAttributes(boolean captureExperimentalAttributes) Sets whether experimental attributes should be set to logs.setCaptureMapMessageAttributes(boolean captureMapMessageAttributes) Sets whether log4jMapMessageattributes should be copied to logs.setCaptureMarkerAttribute(boolean captureMarkerAttribute) Sets whether the marker attribute should be set to logs.setNumLogsCapturedBeforeOtelInstall(int numLogsCapturedBeforeOtelInstall) Log telemetry is emitted after the initialization of the OpenTelemetry Logback appender with anOpenTelemetryobject.setOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry) Configures theOpenTelemetryused to append logs.Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender.Builder
getConfiguration, getLayout, getName, getOrCreateLayout, getOrCreateLayout, isIgnoreExceptions, setConfiguration, setIgnoreExceptions, setLayout, setName, withConfiguration, withIgnoreExceptions, withLayout, withNameMethods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable.Builder
asBuilder, getFilter, getPropertyArray, setFilter, setPropertyArray, withFilter
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setCaptureExperimentalAttributes
@CanIgnoreReturnValue public B setCaptureExperimentalAttributes(boolean captureExperimentalAttributes) Sets whether experimental attributes should be set to logs. These attributes may be changed or removed in the future, so only enable this if you know you do not require attributes filled by this instrumentation to be stable across versions. -
captureCodeAttributes
Sets whether the code attributes (file name, class name, method name and line number) should be set to logs. Enabling these attributes can potentially impact performance (see https://logging.apache.org/log4j/2.x/manual/performance.html#layouts-location).- Parameters:
captureCodeAttributes- To enable or disable the code attributes (file name, class name, method name and line number)
-
setCaptureMapMessageAttributes
Sets whether log4jMapMessageattributes should be copied to logs. -
setCaptureMarkerAttribute
Sets whether the marker attribute should be set to logs.- Parameters:
captureMarkerAttribute- To enable or disable the marker attribute
-
setCaptureContextDataAttributes
Configures theThreadContextattributes that will be copied to logs. -
setNumLogsCapturedBeforeOtelInstall
@CanIgnoreReturnValue public B setNumLogsCapturedBeforeOtelInstall(int numLogsCapturedBeforeOtelInstall) Log telemetry is emitted after the initialization of the OpenTelemetry Logback appender with anOpenTelemetryobject. This setting allows you to modify the size of the cache used to replay the logs that were emitted prior to setting the OpenTelemetry instance into the Logback appender. -
setOpenTelemetry
Configures theOpenTelemetryused to append logs. -
build
- Specified by:
buildin interfaceorg.apache.logging.log4j.core.util.Builder<B extends OpenTelemetryAppender.Builder<B>>
-