huikai

生于忧患,死于安乐


动态调整日志级别

配置springboot-actuator

在pom文件中引入依赖

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-actuator</artifactId>
  4. </dependency>

在配置文件中开启loggers的endPoint端点

  1. management:
  2. endpoints:
  3. web:
  4. exposure:
  5. include: loggers

查询日志级别

查看当前应用所有日志级别

  1. curl http://localhost:8080/actuator/loggers

查看指定包/类日志级别

  1. curl http://localhost:8080/actuator/loggers/ROOT

调整日志级别

  1. curl -X POST -H "Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8" -d '{"configuredLevel":"DEBUG"}' http://localhost:8080/actuator/loggers/ROOT


 samba PVE笔记