Affects: Spring Web MVC 5.3.3
After upgrading from Spring4 to Spring5.3 we face a problem: there is no easy way to log just mappings of Controllers to endpoints.
The expected scenario: during booting a Spring MVC web application we would like to have all endpoint mappings in logs. However we don't want all request processing by Spring MVC to be logged because it would generate enormous amount of logs in production.
Currently, if we enable TRACE log level for org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
we receive both needed logs during boot of the webapp but also all requests processed are logged RequestMappingHandlerMapping - Mapped to ...
).
Please provide a way to just log the endpoint mappings.
The issue was discussed in SO: https://stackoverflow.com/questions/40621044/log-restful-endpoints-on-container-startup-in-a-spring-application
Comment From: rstoyanchev
This has been discussed before. The number of endpoints can vary a lot. For a few controllers it is not an issue but for most applications tens or hundreds of endpoints is too much and floods log output. If necessary to show for debugging, mappings can be enabled at TRACE, as you have done, but otherwise they don't need to shown on every startup.
At runtime you can also use Boot's actuator to check mappings.
That aside we can create a log category that can be used to control the logging of handler mappings only.
Comment From: lrozenblyum
I see, thanks for the explanation, @rstoyanchev! Creating a log category of handler mappings only seems very reasonable and will help solving the issue!
Comment From: lrozenblyum
Thanks @rstoyanchev !
Comment From: aksh1618
@rstoyanchev This seems to have changed the logging level for Router functions: https://github.com/spring-projects/spring-framework/commit/3ec0452fed9675cac4676f05c8ca461f0d96dd30#diff-b43a2a2d87bedde90be033f4385b612063629834aad947032847ab7ff5563fd5L159 This logging was helpful to see dynamically created routes that were populated by a configuration based route generation spring boot based library we are using internally. Is there a way to enable it using properties, or in some other way without the library clients having to modify their logging configuration?