Reputation: 13
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?
Upvotes: 1
Views: 2531
Reputation: 425
You can define and env variable that will disable logs exporting with:
OTEL_LOGS_EXPORTER=none
https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#exporter-selection
Upvotes: 0
Reputation: 251
You can set the system property - otel.javaagent.logging
or environment variable - OTEL_JAVAAGENT_LOGGING
to none
.
Documentation link: https://opentelemetry.io/docs/zero-code/java/agent/configuration/#java-agent-logging-output
Upvotes: 1
Reputation: 675
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.
Upvotes: 4
Reputation: 459
You can use a command line argument to change the log level but since this is an error it will still be written to the console.
I'm not sure why you would want to - but you could create a custom agent that does not log this issue, or logs it with a lower level.
Upvotes: 0