This documentation has an index for AI agents at /llms.txt. A Markdown version of this page is available at https://explorer.opentelemetry.io/java-agent/instrumentation/log4j-appender-2.17.md.

Log4j

OpenTelemetry Java agent instrumentation

This instrumentation bridges Log4j log events to OpenTelemetry logs.

  • Name: log4j-appender-2.17
  • Scope: io.opentelemetry.log4j-appender-2.17
  • Target versions: org.apache.logging.log4j:log4j-core:[2.0,)
  • Library: https://logging.apache.org/log4j/2.x/

Configuration

OptionTypeDefaultDescription
otel.instrumentation.log4j-appender.experimental-log-attributesbooleanfalseEnables the capture of experimental log attributes, including thread name and thread ID.
otel.instrumentation.log4j-appender.experimental.capture-argumentsbooleanfalseEnables the capture of the log message arguments.
otel.instrumentation.log4j-appender.experimental.capture-code-attributesbooleanfalseEnables the capture of code location attributes, including file path, class name, method name, and line number.
otel.instrumentation.log4j-appender.experimental.capture-map-message-attributesbooleanfalseEnables the capture of attributes from Log4j MapMessage instances.
otel.instrumentation.log4j-appender.experimental.capture-marker-attributebooleanfalseEnables the capture of the Log4j marker attribute.
otel.instrumentation.log4j-appender.experimental.capture-mdc-attributeslistControls which MDC attributes to capture. Use "*" to capture all MDC attributes or provide a comma-separated list of specific keys.
otel.instrumentation.log4j-appender.experimental.capture-templatebooleanfalseEnables the capture of the log message template (if arguments are provided).

Data

  • JSON: /data/javaagent/instrumentations/log4j-appender-2.17/log4j-appender-2.17-e4750cae6604.json
  • Explore: /java-agent/instrumentation/log4j-appender-2.17