Skip to content

Commit

Permalink
feat : 로그 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
funnysunny08 committed Nov 28, 2024
1 parent 4ba3e09 commit 1651687
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import com.lovemarker.global.constant.ErrorCode;
import com.lovemarker.global.dto.ApiResponseDto;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
Expand All @@ -13,6 +15,7 @@
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

Expand All @@ -38,6 +41,8 @@ protected ApiResponseDto handleMissingRequestHeaderException(final MissingReques
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
protected ApiResponseDto<Object> handleException(final Exception error, final HttpServletRequest request) {
log.error(error.getMessage());
log.error(Arrays.toString(error.getStackTrace()));
return ApiResponseDto.error(ErrorCode.INTERNAL_SERVER_ERROR);
}

Expand Down

0 comments on commit 1651687

Please sign in to comment.