I am using Spring Boot 3.2.2 , JDK 21, Maven. File pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<relativePath/>
</parent>
<groupId>vy</groupId>
<artifactId>certificate_spring</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>certificate_spring</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
File application.properties
logging.level.root=INFO
File CertificateSpringApplication.java
package vy.certificate_spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CertificateSpringApplication {
public static void main(String[] args) {
SpringApplication.run(CertificateSpringApplication.class, args);
}
}
File FooController.java
package vy.certificate_spring.account.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller("/foo")
public class FooController {
@GetMapping("/bar")
public String bar(){
return "bar";
}
}
The reference document at here https://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#loggers.all said go to http://localhost:8080/actuator/loggers , but I see it did not work.
Why Spring Boot actuator logger end-point did not work?
You have to define which endpoints are exposed using the following property management.endpoints.web.exposure.include
. You can add all endpoints using
management.endpoints.web.exposure.include=*