fix: 4xx 비즈니스 예외를 WARN 레벨로 기록하도록 수정 - #486
Merged
Merged
Conversation
📊 테스트 커버리지 리포트
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ Issue Number
📝 요약(Summary)
ControllerLogAspect가 컨트롤러에서 발생한 모든 예외를log.error(..., e)로 기록했습니다. 그래서NOT_FOUND_MENU같은 정상적인 4xx 비즈니스 예외도 ERROR 레벨에 스택트레이스까지 남았습니다.BaseException과 예상하지 못한 예외: ERROR에 스택트레이스를 남기고 Slack으로 알립니다. 기존과 같습니다.BaseException: WARN 한 줄로 남깁니다. 스택트레이스는 남기지 않고,type과cause메시지는 그대로 유지합니다.shouldNotifySlack에서isServerError로 바꿨습니다. 이제 로그 레벨과 Slack 알림 두 곳에서 같이 쓰기 때문입니다.💬 공유사항 to 리뷰어
BaseException이 아니면 5xx"로 판단합니다. 컨트롤러에서@PreAuthorize나ResponseStatusException처럼BaseException이 아니면서 4xx로 바뀌는 예외를 던지는 코드가 없는 것을 확인했습니다. 앞으로 이런 예외를 도입하면 이 조건도 함께 손봐야 합니다.Resolved [...]WARN 로그는BaseException에 메시지가 없어서 클래스 이름만 찍힙니다. 그래서 어떤 에러였는지(cause=...)는 Aspect 로그에만 남습니다. 4xx 요청 하나에 WARN 두 줄이 남는 셈이고, 둘은 같은requestId로 묶입니다.ListAppender로 실제 찍힌 로그를 잡아서 검증하는 테스트 2개를 추가했습니다. 4xx는 WARN이고 스택트레이스가 없는지, 5xx는 ERROR이고 스택트레이스가 있는지 확인합니다.{service_name="eatssu-dev"} | json | level="ERROR"로 조회해서 해당 요청이 나오지 않는지,level="WARN"으로는 나오는지 확인합니다.✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.
🤖 Generated with Claude Code