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 1.8
- Docker compose
Run the collector via docker
docker-compose up
In a separate shell, run the application
../gradlew run
Watch the collector logs to see exported log records