▶ Spring Boot Dependency and Configuration

Maven rely on

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

Physical configuration

management.endpoints.web.exposure.include=loggers
Copy the code

▶ Initialize the log level

Optional log level

  • OFF
  • ERROR
  • WARN
  • INFO
  • DEBUG
  • TRACE

Set the global log level

logging.level.root=INFO
Copy the code

Sets a specific Package/Class log level

logging.level.<Package/Class>=INFO
Copy the code

Example: logging.level.com.anoyi=INFO

▶ Configure the log level at runtime

View the configuration of all package/class log levels

The curl http://127.0.0.1:8080/actuator/loggersCopy the code

View the configuration of a single package/class log level

# # usage curl http://127.0.0.1:8080/actuator/loggers/ < Package/Class > sample curl http://127.0.0.1:8080/actuator/loggers/com.anoyiCopy the code

Dynamically changing the log level

# use curl -x POST \ http://localhost:8080/actuator/loggers/ < Package/Class > \ - d '{" configuredLevel ":" < LEVEL > "}' # sample curl -X POST \ http://localhost:8080/actuator/loggers/com.anoyi \ -d '{"configuredLevel":"DEBUG"}'Copy the code

▶ Github Demo URL

  • https://github.com/ChinaSilence/spring-boot-demos/tree/master/02%20-%20logging%20(dynamic%20level)

Double 11 still building? Teenager you should master Docker deployment Consul by now

● Spring Boot Configuration – Consul Configuration center

● Play wechat every day, Spring Boot development of private instant messaging system to understand

● SpringBoot correctly hits the log posture

● Spring Boot custom parent quickly build applications

● Spring Boot container deployment – Docker

● SpringBot teaches you how to configure HTTPS

Are you still using Logback?

● How does the micro-service registry carry tens of millions of visits of large systems?

Here’s how you should play it

● Spring Boot exception processing

● Spring Boot Configuration – Configuration information encryption

● Reject black box applications – Visual monitoring of Spring Boot applications

● There are three sources of concurrency bugs, so keep your eyes open

This article is published by OpenWrite!