728x90
Spring Boot 1.x 에서는 해당 RequestMappingHandlerAdapter 로그가 자세하게 찍혔지만 Spring Boot 2.x 부터는 별도로 설정을 해줘야 한다.
Spring Boot 1.x 당시 로그
2020-02-11 15:32:39.293 INFO 48395 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-02-11 15:32:39.482 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7ff95560: startup date [Tue Feb 11 15:32:37 CST 2020]; root of context hierarchy
2020-02-11 15:32:39.568 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/{id}],methods=[GET]}" onto public com.didispace.chapter26.User com.didispace.chapter26.UserController.getUser(java.lang.Long)
2020-02-11 15:32:39.569 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/{id}],methods=[PUT]}" onto public java.lang.String com.didispace.chapter26.UserController.putUser(java.lang.Long,com.didispace.chapter26.User)
2020-02-11 15:32:39.570 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/],methods=[GET]}" onto public java.util.List<com.didispace.chapter26.User> com.didispace.chapter26.UserController.getUserList()
2020-02-11 15:32:39.570 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/],methods=[POST]}" onto public java.lang.String com.didispace.chapter26.UserController.postUser(com.didispace.chapter26.User)
2020-02-11 15:32:39.570 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/{id}],methods=[DELETE]}" onto public java.lang.String com.didispace.chapter26.UserController.deleteUser(java.lang.Long)
2020-02-11 15:32:39.573 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-02-11 15:32:39.573 INFO 48395 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-02-11 15:32:39.590 INFO 48395 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-02-11 15:32:39.590 INFO 48395 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Spring Boot 2.x 에서 바뀐 로그 형태
2022-12-21 15:34:15.280 INFO 48784 --- [main] c.d.chapter26.Chapter26Application : Starting Chapter26Application on zhaiyongchaodeMacBook-Pro.local with PID 48784 (/Users/zhaiyongchao/Documents/git/github/SpringBoot-Learning/2.1.x/chapter2-6/target/classes started by zhaiyongchao in /Users/zhaiyongchao/Documents/git/github/SpringBoot-Learning/2.1.x)
2022-12-21 15:34:15.283 INFO 48784 --- [main] c.d.chapter26.Chapter26Application : No active profile set, falling back to default profiles: default
2022-12-21 15:34:16.556 INFO 48784 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-12-21 15:34:16.587 INFO 48784 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-12-21 15:34:16.588 INFO 48784 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
2022-12-21 15:34:16.596 INFO 48784 --- [main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/zhaiyongchao/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2022-12-21 15:34:16.702 INFO 48784 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-12-21 15:34:16.702 INFO 48784 --- [main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1377 ms
2022-12-21 15:34:16.954 INFO 48784 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2022-12-21 15:34:17.187 INFO 48784 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-12-21 15:34:17.192 INFO 48784 --- [main] c.d.chapter26.Chapter26Application : Started Chapter26Application in 2.238 seconds (JVM running for 2.764)
application.properties 파일에 아래 값을 추가
logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping=trace
아래와 같이 로그 출력 내용이 변경되었다.
2022-12-21 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)
2022-12-21 15:36:09.791 TRACE 49215 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping :
o.s.b.a.w.s.e.BasicErrorController:
{ /error}: error(HttpServletRequest)
{ /error, produces [text/html]}: errorHtml(HttpServletRequest,HttpServletResponse)
2022-12-21 15:36:09.793 DEBUG 49215 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : 7 mappings in 'requestMappingHandlerMapping'
끝!
'Springboot2.x 강좌 > API개발' 카테고리의 다른 글
XML에 대한 요청 및 응답 처리 (0) | 2023.01.04 |
---|---|
SpringFox 3 및 Swagger 설정 (0) | 2023.01.04 |
Swagger 의 api 들을 효율적으로 분리하기 (0) | 2023.01.04 |
JSR-303 그리고 validation 체크 (0) | 2023.01.04 |
문서자동화 도구 Swagger2를 사용해보자 (0) | 2023.01.04 |