# Log4j

<!-- llms-txt-link: /llms.txt -->

> 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. |

## Data

- **JSON**: [/data/javaagent/instrumentations/log4j-appender-1.2/log4j-appender-1.2-efb6f9340880.json](/data/javaagent/instrumentations/log4j-appender-1.2/log4j-appender-1.2-efb6f9340880.json)
- **Explore**: [/java-agent/instrumentation/log4j-appender-1.2](/java-agent/instrumentation/log4j-appender-1.2)
