Skip to content
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

[BE] feat: WARN 로그 스택 트레이스 출력 제거 (#437) #438

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading