0

I have a problem to log any existing endpoint in spring boot application. This is my simple project with one rest endpoint. When i run the application in console i cannot see any logs about mappings. In older spring boot version, spring always logs automatically all existing mappings in project. What I should configure to make spring boot log my endpoint mapping like below:

2019-08-05 18:22:15.317 TRACE 11435 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped [/**] onto ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]

This is the repository to my example project https://bitbucket.org/powrseba/spring-boot-example/src/singleModule/

ThanhPhanLe
  • 1,315
  • 3
  • 14
  • 25
Sebastian
  • 92
  • 2
  • 14

2 Answers2

1

Okey as @davidxxx wrote it is duplicate. I don't wrote the paragraph about changes in Spring Boot 2.1 that default logs configuration have changed.

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#logging-refinements

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

Post to close :)

Community
  • 1
  • 1
Sebastian
  • 92
  • 2
  • 14
0

Do you really need to logs existing mapping to logs ? There is a lot of alternative with more value that permit you to access existing apis.

Spring Boot provide a dependency to Actuator. It will exposing a dedicated endpoint called mappings returning existing mappings accessible under /actuator/mappings.

Actuator supply a lot of features like health indicator, application information, logger value, properties, etc.

It's completely integrated with spring and spring-security. If you never heard about it, just take a look.

Martin Choraine
  • 2,296
  • 3
  • 20
  • 37
  • I dont need but i am curious why when I have create project by spring initializer in the past before spring boot 2.0.0 i always have that feature by default but now when i create project in spring boot higher then 2.1.0 i dont have that logs – Sebastian Aug 05 '19 at 16:41
  • And if the actuator was not correctly mapped, how to diagnostic all mapped urls ? I don't tell that logging these information systematically is a good idea but to get this information as soon as the spring boot startup may be interesting in some cases/things to fix. Overall when you have to restart 10 times because you don't understand why an URL doesn't work. – davidxxx Aug 05 '19 at 17:05