gpt4 book ai didi

java - spring boot 2.x 控制台日志不打印映射的 Controller 信息

转载 作者:行者123 更新时间:2023-12-01 16:45:11 24 4
gpt4 key购买 nike

我可以在网络浏览器中访问 Controller ,但在控制台日志中看不到其映射消息。正常情况下,当 Spring Boot 应用程序启动时,Eclipse 控制台应该打印出映射的 Controller 和访问 url,为什么我没有看到它?

我已经将 logging.level.org.springframework.web=DEBUG 添加到 application.properties 文件中,但没有帮助。

更新:这是我的 pom.xml 文件:

<modelVersion>4.0.0</modelVersion>

<groupId>com.yp</groupId>
<artifactId>BootTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BootTest</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<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>

The snippet of console log when app starts

有什么方法可以在应用程序启动时显示映射的 Controller 信息?

最佳答案

请查看Spring Boot 2.1 Release Notes#logging-refinements

Spring Framework 5.1 revisited the debug logging output while working on web applications (Spring MVC or Spring WebFlux). If you are trying to debug an application and you want to restore Spring Boot 2.0 style logging you should add the following to your application.properties:

logging.level.web=debug

You might also want to set spring.http.log-request-details to true to log actual request details. By default this property is false as it can potentially expose sensitive information.

关于java - spring boot 2.x 控制台日志不打印映射的 Controller 信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53141849/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com