How to Restore Spring Boot 2.1.x Request Mapping Logs with TRACE Level
This article explains why Spring Boot 2.1.x stopped printing HTTP request mappings, shows that the log level was changed from INFO to TRACE, and provides the exact configuration needed to re‑enable detailed endpoint logs during application startup.
Retrieve Request Path List from Logs
If you have followed earlier Spring Boot 1.x tutorials or are familiar with Spring MVC, the startup logs used to list all HTTP endpoints created by the application. These logs were produced by
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMappingscanning @Controller and @RequestMapping annotations.
Since Spring Boot 2.1.0 the log level for this information was changed from INFO to TRACE, so the endpoint list no longer appears by default. To restore it, add the following line to application.properties:
logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping=traceAfter restarting the application, TRACE logs will display each controller and its mappings, for example:
2020-02-11 15:36:09.787 TRACE 49215 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping :
c.d.c.UserController:
{PUT /users/{id}}: putUser(Long,User)
{GET /users/{id}}: getUser(Long)
{POST /users/}: postUser(User)
{GET /users/}: getUserList()
{DELETE /users/{id}}: deleteUser(Long)
...The new output groups mappings by controller class, making it easier for developers to locate which HTTP endpoints have been initialized.
Code Example
The full project source can be found in the chapter2-6 directory of the repository:
GitHub: https://github.com/dyc87112/SpringBoot-Learning/
Gitee: https://gitee.com/didispace/SpringBoot-Learning/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
