Skip to content

Commit

Permalink
fix: VerifyUserFilter 에서 예외 발생 시 log 찍도록 변경 및 interceptor 에서 예외 발생 시 …
Browse files Browse the repository at this point in the history
…log 찍도록 변경
  • Loading branch information
wjddn2165 committed Aug 20, 2024
1 parent 6c5bfed commit 32f84d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServl

@Override
public void afterCompletion(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler, Exception ex) {
// 예외 발생 시 로그 추가
if (ex != null) {
log.error("Exception [{}]", ex.getMessage());
}

log.info("Response {} [{}]", response.getStatus(), handler);

// 요청이 완료된 후 MDC에서 requestId 제거
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
request.setAttribute(AUTHENTICATE_USER, user);
chain.doFilter(request, response);
} catch (Exception e) {
log.error("Fail User Verify");
log.error("Fail User Verify: {}", e.getMessage());
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
httpServletResponse.sendError(HttpStatus.BAD_REQUEST.value(), e.getMessage());
}
Expand Down

0 comments on commit 32f84d9

Please sign in to comment.