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.

Programmer DD
Programmer DD
Programmer DD
How to Restore Spring Boot 2.1.x Request Mapping Logs with TRACE Level

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.RequestMappingHandlerMapping

scanning @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=trace

After 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/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javabackend-developmentloggingSpring BoottraceRequestMapping
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.