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

  • 相关阅读:
    每日一题_191208
    每日一题_191207
    每日一题_191206
    每日一题_191205
    每日一题_191204
    每日一题_191203
    每日一题_191202
    每日一题_191201
    每日一题_191130
    2020届成都一诊理科16题
  • 原文地址:https://www.cnblogs.com/myesn/p/15349215.html
Copyright © 2020-2023  润新知