Logging工 (Logging)
这Logging端点提供访问应用程序日志及其层级配置的权限。
回收所有Logging机
要获取应用程序的日志,请获取请求/执行器/Logging器如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/loggers' -i -X GET
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 791
{
"levels" : [ "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE" ],
"loggers" : {
"ROOT" : {
"configuredLevel" : "INFO",
"effectiveLevel" : "INFO"
},
"com.example" : {
"configuredLevel" : "DEBUG",
"effectiveLevel" : "DEBUG"
}
},
"groups" : {
"test" : {
"configuredLevel" : "INFO",
"members" : [ "test.member1", "test.member2" ]
},
"web" : {
"members" : [ "org.springframework.core.codec", "org.springframework.http", "org.springframework.web", "org.springframework.boot.actuate.endpoint.web", "org.springframework.boot.web.servlet.ServletContextInitializerBeans" ]
},
"sql" : {
"members" : [ "org.springframework.jdbc.core", "org.hibernate.SQL", "org.jooq.tools.LoggerListener" ]
}
}
}
回收单个Logging机
要检索单个记录器,请创建获取请求/执行器/日志器/{logger.name}如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/loggers/com.example' -i -X GET
前例检索的是关于名为 的记录器的信息com.example.
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Disposition: inline;filename=f.txt
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 61
{
"configuredLevel" : "INFO",
"effectiveLevel" : "INFO"
}
检索单个组
要检索单个组,请获取请求/执行器/日志机/{group.name},
如下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/loggers/test' -i -X GET
前面的例子检索了关于名为 的日志组的信息测试.
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 82
{
"configuredLevel" : "INFO",
"members" : [ "test.member1", "test.member2" ]
}
设置原木水平
要设置记录器的电平,可以设置发布请求/执行器/日志器/{logger.name}带有一个JSON主体,指定了日志器的配置级别,如下基于卷的示例所示:
$ curl 'http://localhost:8080/actuator/loggers/com.example' -i -X POST \
-H 'Content-Type: application/json' \
-d '{"configuredLevel":"debug"}'
前述示例设置了configuredLevel关于com.exampleLogging器转调试.
为群体设定日志等级
要设置记录器的电平,可以设置发布请求/执行器/日志机/{group.name}带有一个 JSON 主体,指定了日志组的配置级别,如下基于卷的示例所示:
$ curl 'http://localhost:8080/actuator/loggers/test' -i -X POST \
-H 'Content-Type: application/json' \
-d '{"configuredLevel":"debug"}'
前述示例设置了configuredLevel关于测试Logger 组 到调试.
清理原木层
要清除记录器的层级,请设置发布请求/执行器/日志器/{logger.name}其中有一个包含空对象的JSON主体,如以下基于卷的示例所示:
$ curl 'http://localhost:8080/actuator/loggers/com.example' -i -X POST \
-H 'Content-Type: application/json' \
-d '{}'
上述示例清除了配置级别的com.example记录。