6.6. 配置 Service Registry 日志
您可以在运行时设置 Service Registry 日志记录配置。Service Registry 提供了一个 REST 端点,用于为特定日志记录器设置日志级别,以进行精细的日志记录。本节介绍如何使用 Service Registry /admin REST API 在运行时查看和设置 Service Registry 日志级别。
先决条件
-
获取用于访问 Service Registry 实例的 URL,如果 OpenShift 上部署了 Service Registry,则获取您的 Service Registry 路由。此简单示例使用
localhost:8080的 URL。
流程
使用此
curl命令获取日志记录器io.apicurio.registry.storage的当前日志级别:$ curl -i localhost:8080/apis/registry/v2/admin/loggers/io.apicurio.registry.storage HTTP/1.1 200 OK [...] Content-Type: application/json {"name":"io.apicurio.registry.storage","level":"INFO"}使用此
curl命令将日志记录器io.apicurio.registry.storage的日志级别更改为DEBUG:$ curl -X PUT -i -H "Content-Type: application/json" --data '{"level":"DEBUG"}' localhost:8080/apis/registry/v2/admin/loggers/io.apicurio.registry.storage HTTP/1.1 200 OK [...] Content-Type: application/json {"name":"io.apicurio.registry.storage","level":"DEBUG"}使用此
curl命令将日志记录器io.apicurio.registry.storage的日志级别恢复到其默认值:$ curl -X DELETE -i localhost:8080/apis/registry/v2/admin/loggers/io.apicurio.registry.storage HTTP/1.1 200 OK [...] Content-Type: application/json {"name":"io.apicurio.registry.storage","level":"INFO"}