This example demonstrates an application configured to use the OpenTelemetry log appenders to bridge logs into the OpenTelemetry Log SDK and export via OTLP.
Details about the example:
- The OpenTelemetry Log SDK is configured to export data to the Collector, which prints the logs to the console
- The application is configured with a variety of log solutions:
- Log4j API configured to print logs to the console and the OpenTelemetry Log4j Appender
- SLF4J API configured with Logback to print logs to the console and the OpenTelemetry Logback Appender
- JUL to SLF4J, which bridges JUL logs to the SLF4J API and ultimately to Logback
- Demonstrates how trace context is propagated to logs when recorded within a span
- Java 17 or higher is required to run Gradle and build this example
- Java 11 or higher is required to run the compiled example
- Docker Compose
Run the Collector via Docker:
docker compose upIn a separate shell, run the application:
../gradlew runWatch the Collector logs to see exported log records.