配置Actuator

<!-- web start--> <dependency>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- web end--> <!-- actuator start--> <dependency>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- actuator end--> 

2、修改配置信息
修改management.endpoints.web.exposure.include为"*"
在application.yml或者bootstarp.yml里增加配置:

management:     endpoints:         web:              exposure:                 include: "*" 

3、请求接口查看所有日志级别
根据IP+端口+请求路径(/actuator/loggers)获取所有日志级别。如:
localhost:8080/actuator/loggers
springboot在线调整log日志级别

4、获取某一个类(包)的日志级别
根据IP+端口+请求路径(/actuator/loggers/包名或者全类名)获取单个日志日志级别。如:
localhost:8080/actuator/loggers/com.alibaba.druid.pool.DruidDataSourceStatLoggerImpl
springboot在线调整log日志级别

5、修改某个类(包)的日志级别
通过postman请求修改某个日志级别,如:
springboot在线调整log日志级别
请求的curl为:

curl --location --request POST 'http://localhost:9151/actuator/loggers/com.alibaba.druid' \ --header 'Content-Type: application/json' \ --data-raw '{     "configuredLevel": "DEBUG" }' 

结果为
springboot在线调整log日志级别

通过接口进行修改logger级别,仅在当前运行项目有效。项目重启后就会失效!!!