Commit d84a960
authored
feat: 로깅 초기 버전 구축 (#9)
# 변경점 👍
1. elk + filebeat를 활용한 로깅 초기 버전 구축
2. `LoggingFilter`를 만들어서 요청/응답 로그를 남기도록 추가함
필터에서 로그를 남기는 이유는 다음과 같음
스프링 MVC의 구조는 아래와 같다.
```java
HTTP 요청 -> WAS -> 필터 -> 서블릿 -> 스프링 인터셉터 -> 컨트롤러
```
커스텀해서 가장 빨리 처리할 수 있는 부분은 필터이다.
하지만 인터셉터가 필터보다 더 많은 기능을 제공하기 때문에 인터셉터를 사용해도되지 않나 싶지만, 인터셉터에서 로깅을 처리할
경우에는 단점이 존재한다.
**바로 인터셉터가 `GlobalExceptionHandler`보다 뒤에 위치한다는 것**
→ 이 때문에 필터에서 로깅을 처리했음. (`GlobalExceptionHandler` 에서 잡히는 예외를 굳이 error로그로
남길필요가 없는 것 같음)
→ 또한 시큐리티 필터체인에서 처리 못한 예외도 로깅필터를 맨 앞에 위치시킨다면 해당 예외를 로그로 남길 수 있다.
# 스크린샷 🖼
<img width="2480" height="1240" alt="image"
src="https://github.com/user-attachments/assets/756f2607-c168-46ad-b988-b5ac5d1e5c11"
/>
<img width="2344" height="936" alt="image"
src="https://github.com/user-attachments/assets/213acebf-748a-44ee-a239-0a95485ba272"
/>
# 작업내용 ✏
현재는 클라이언트 요청이 정상적으로 반환되었을 때는 `trace` level로 기록하는데 이걸 `info` level로 올려서
정상 요청/응답 로그까지 저장할지 고민1 parent 93c19e6 commit d84a960
File tree
4 files changed
+82
-2
lines changed- .github/workflows
- src/main
- java/apptive/team5
- config
- filter
- resources
4 files changed
+82
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
11 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments