Log4j
OpenTelemetry Java agent instrumentation
This instrumentation bridges Log4j log events to OpenTelemetry logs.
- Name:
log4j-appender-1.2 - Scope:
io.opentelemetry.log4j-appender-1.2 - Target versions:
log4j:log4j:[1.2,) - Library: https://logging.apache.org/log4j/1.2/
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
otel.instrumentation.log4j-appender.experimental-log-attributes | boolean | false | Enables the capture of experimental log attributes, including thread name and thread ID. |
otel.instrumentation.log4j-appender.experimental.capture-code-attributes | boolean | false | Enables the capture of code location attributes, including file path, class name, method name, and line number. |
otel.instrumentation.log4j-appender.experimental.capture-mdc-attributes | list | Controls which MDC attributes to capture. Use "*" to capture all MDC attributes or provide a comma-separated list of specific keys. |