简体   繁体   English

OTEL 代理如何禁用日志记录

[英]OTEL Agent How to disable logging

We are using OTEL Java agent as follow我们使用 OTEL Java 代理如下

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每当 Dotel.exporter.jaeger.endpoint 无法访问或出现任何其他问题时,它都会打印出错误消息

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?我们可以禁用 OTEL Java 代理的日志记录或为 OTEL Java 代理设置日志级别吗?

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.我不确定您为什么要这样做 - 但您可以创建一个不记录此问题的自定义代理,或者以较低级别记录它。

You can simply switch off the logging completely for the OpenTelemetry Java Agent with this command line argument on starting the JVM:您可以在启动 JVM 时使用此命令行参数简单地完全关闭 OpenTelemetry Java 代理的日志记录:

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

This will suppress the otel.javaagent messages on missing exporter endpoint.这将在缺少导出端点时抑制otel.javaagent消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM