Skip to content

Commit

Permalink
[BE] feat: WARN 로그 스택 트레이스 출력 제거 (#437) (#438)
Browse files Browse the repository at this point in the history
* fix: WARN 로그에 스택 트레이스 제거

* chore: 줄바꿈 수정
  • Loading branch information
seokjin8678 authored and BGuga committed Oct 17, 2023
1 parent 7ed0153 commit 545715d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {

private static final String LOG_FORMAT_INFO = "\n[🔵INFO] - ({} {})\n(id: {}, role: {})\n{}\n {}: {}";
private static final String LOG_FORMAT_WARN = "\n[🟠WARN] - ({} {})\n(id: {}, role: {})\n{}";
private static final String LOG_FORMAT_WARN = "\n[🟠WARN] - ({} {})\n(id: {}, role: {})\n{}\n {}: {}";
private static final String LOG_FORMAT_ERROR = "\n[🔴ERROR] - ({} {})\n(id: {}, role: {})";
// INFO
/*
Expand All @@ -37,7 +37,6 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
(id: 1, role: MEMBER)
FOR_TEST_ERROR
com.festago.exception.InternalServerException: 테스트용 에러입니다.
at com.festago.presentation.AdminController.getWarn(AdminController.java:134)
*/

// ERROR
Expand Down Expand Up @@ -97,15 +96,14 @@ public ResponseEntity<ErrorResponse> handle(Exception e, HttpServletRequest requ
private void logInfo(FestaGoException e, HttpServletRequest request) {
if (errorLogger.isInfoEnabled()) {
errorLogger.info(LOG_FORMAT_INFO, request.getMethod(), request.getRequestURI(), authenticateContext.getId(),
authenticateContext.getRole(), e.getErrorCode(),
e.getClass().getName(), e.getMessage());
authenticateContext.getRole(), e.getErrorCode(), e.getClass().getName(), e.getMessage());
}
}

private void logWarn(FestaGoException e, HttpServletRequest request) {
if (errorLogger.isWarnEnabled()) {
errorLogger.warn(LOG_FORMAT_WARN, request.getMethod(), request.getRequestURI(), authenticateContext.getId(),
authenticateContext.getRole(), e.getErrorCode(), e);
authenticateContext.getRole(), e.getErrorCode(), e.getClass().getName(), e.getMessage());
}
}

Expand Down

0 comments on commit 545715d

Please sign in to comment.