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 可实现整体性修改

  • 相关阅读:
    C#-练习题
    C#-命名空间(十五)
    C#-枚举(十三)
    C#-多态(十二)
    C#-继承(十一)
    C#-结构体(十)
    C#-类(九)
    C#-方法(八)
    二叉树深度遍历和广度遍历
    iOS main.m解析
  • 原文地址:https://www.cnblogs.com/myesn/p/15349215.html
Copyright © 2011-2022 走看看