zoukankan      html  css  js  c++  java
  • Spring Boot 动态修改 log level

    引入依赖

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    

    修改配置

    management: # https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.enabling
      endpoints:
          exposure:
            include: loggers
    

    运行程序

    运行 Spring Boot 程序

    日志级别查询与修改

    查看全部

    请求方式:HTTP GET
    请求地址:http://{ip}:{host}/actuator/loggers

    查看某个

    请求方式:HTTP GET
    请求地址:http://{ip}:{host}/actuator/loggers/{name}

    例如 http://{ip}:{host}/actuator/loggers/ROOT

    修改某个

    请求方式:HTTP POST
    内容类型:Content-Type:application/json
    请求地址:http://{ip}:{host}/actuator/loggers/{name}
    请求参数:

    {
        "configuredLevel": "WARN"
    }
    

    修改 ROOT 可实现整体性修改

  • 相关阅读:
    assignment of day nine
    不会互相转化,看我的
    enumrate用法
    这是作业
    这是表格
    本周回顾
    爬虫
    今天又学了啥?
    what have we learnt in day five
    OMG that's another blog!
  • 原文地址:https://www.cnblogs.com/myesn/p/15349215.html
Copyright © 2011-2022 走看看