-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: HTTP 로깅 추가 #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: HTTP 로깅 추가 #349
Conversation
| <dependency> | ||
| <groupId>ch.qos.logback</groupId> | ||
| <artifactId>logback-core</artifactId> | ||
| <version>1.3.11</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java버전별 logback 버전: https://logback.qos.ch/news.html
| </context-param> | ||
| <filter> | ||
| <filter-name>TeeFilter</filter-name> | ||
| <filter-class>ch.qos.logback.access.servlet.TeeFilter</filter-class> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TeeFilter 라는 Spring Filter (라이브러리에서 구현됨)에서 HTTP들을 캡쳐함.
| <filter-mapping> | ||
| <filter-name>TeeFilter</filter-name> | ||
| <url-pattern>/swagger-ui.html</url-pattern> <!-- Add the URL pattern you want to exclude --> | ||
| <dispatcher>REQUEST</dispatcher> <!-- Exclude only request type --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swagger 문서를 응답해주는 경우 body(html)이 너무 길어져서, 해당 경우는 url pattern으로 로깅을 하지 않도록 함.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fullRequest가 HTTP 요청 메시지를 로깅하는 레이아웃인데, (참고: https://logback.qos.ch/manual/layouts.html#fullRequest)
Spring3 에서는 이를 인식하지 못해서(PARSER_ERROR 발생) 톰캣의 conf에 해당 파일을 추가해주어야 함.
부트에서는 내장 톰캣이라 스프링 코드 or xml로 처리가 가능함 ㅠ..
Choi-JJunho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인~ 이제 로깅이 점더 꼼곰해지겠네
▶ Request
Content
#348
as-is
to-be
예시 모습
🧪 Test
논의사항
전제
dev 환경의 톰캣 환경설정 (tomcat/conf)를 수정해주어야 함.
방법1
수동으로 추가해준 후 해당 내용을 문서화 (기존 방식)
방법2
자동으로 추가되도록 스크립트를 작성
하고싶은 방법
방법1로 진행하고 싶다.
왜냐하면 (1) 빠르게 적용해야하고 (2) 부트로 이관하는 전까지만 문서로 관리하는 건 어렵지 않을 것 같다.
참고