diff --git a/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java b/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java index bd6241793..01447a622 100644 --- a/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java @@ -1,27 +1,32 @@ package com.votogether.exception; +import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +@Slf4j @RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler public ResponseEntity handleException(final Exception e) { + log.error("[" + e.getClass() + "] : " + e.getMessage()); return ResponseEntity.internalServerError() .body(new ExceptionResponse(-9999, "알 수 없는 서버 에러가 발생했습니다.")); } @ExceptionHandler public ResponseEntity handleBadRequestException(final BadRequestException e) { + log.warn("[" + e.getClass() + "] : " + e.getMessage()); return ResponseEntity.badRequest() .body(ExceptionResponse.from(e)); } @ExceptionHandler public ResponseEntity handleNotFoundException(final NotFoundException e) { + log.warn("[" + e.getClass() + "] : " + e.getMessage()); return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(ExceptionResponse.from(e)); }