javatraceopen-telemetryjaegerobservability

OTEL Agent How to disable logging


We are using OTEL Java agent as follow

java -javaagent:path/to/opentelemetry-javaagent.jar \
     -Dotel.resource.attributes=service.name=your-service-name \
     -Dotel.traces.exporter=jaeger\
     -Dotel.exporter.jaeger.endpoint=<IP>
     -jar myapp.jar

whenever Dotel.exporter.jaeger.endpoint is not reachable or for any other issues, it will print out the error messages

example:

otel.javaagent 2022-04-27 17:44:59:056 +0530] [OkHttp http://localhost:55680/...] ERROR io.opentelemetry.exporter.otlp.internal.grpc.OkHttpGrpcExporter - Failed to export spans. The request could not be executed.

Can we disable the logging for OTEL Java Agent or set log level for OTEL Java Agent?


Solution

  • You can simply switch off the logging completely for the OpenTelemetry Java Agent with this command line argument on starting the JVM:

    -Dio.opentelemetry.javaagent.slf4j.simpleLogger.defaultLogLevel=off
    

    This will suppress the otel.javaagent messages on missing exporter endpoint.