基本配置
management: server: # address: 127.0.0.1 # http://localhost:19988/duno/actuator/info 默认地址 # http://localhost:19988/duno/tiger/act/info 配置base-path后的地址 port: 19988 servlet: context-path: /duno endpoints: web: base-path: /tiger/act exposure: include: '*' #exclude: env endpoint: shutdown: enabled: false health: show-details: always # never, always, when-authorized trace: http.enabled: false
loggers endpoint,可以通过访问http://localhost:19988/duno/tiger/act/loggers来进入。它展示了应用中可配置的loggers的列表和相关的日志等级。
你同样能够使用http://localhost:19988/duno/tiger/act/loggers/{name}来展示特定logger的细节。
举个例子,为了获得root logger的细节,你可以使用http://localhost:19988/duno/tiger/act/loggers/root:
{ "configuredLevel":"INFO", "effectiveLevel":"INFO" }在运行时改变日志等级
loggers endpoint也允许你在运行时改变应用的日志等级。
举个例子,为了改变root logger的等级为DEBUG ,发送一个POST请求到http://localhost:19988/duno/tiger/act/loggers/root,加入如下参数
{ "configuredLevel": "DEBUG" }
这个功能对于线上问题的排查非常有用。
同时,你可以通过传递null值给configuredLevel来重置日志等级。