diff --git a/src/main/java/com/sopterm/makeawish/domain/user/KakaoTokenManager.java b/src/main/java/com/sopterm/makeawish/domain/user/KakaoTokenManager.java index 2b4acc44..df2b08d2 100644 --- a/src/main/java/com/sopterm/makeawish/domain/user/KakaoTokenManager.java +++ b/src/main/java/com/sopterm/makeawish/domain/user/KakaoTokenManager.java @@ -22,7 +22,8 @@ import java.time.LocalDateTime; import java.util.Objects; -import static com.sopterm.makeawish.common.message.ErrorMessage.*; +import static com.sopterm.makeawish.common.message.ErrorMessage.FAILED_VALIDATE_KAKAO_LOGIN; +import static com.sopterm.makeawish.common.message.ErrorMessage.INVALID_CODE; @Slf4j @Service @@ -58,7 +59,10 @@ public String getAccessTokenByCode(String code, String redirectUri) throws JsonP ); // HTTP 응답 (JSON) -> 액세스 토큰 파싱 String responseBody = response.getBody(); - if(Objects.isNull(responseBody)) throw new IllegalArgumentException(INVALID_CODE.getMessage()); + if (Objects.isNull(responseBody)) { + log.error("KakaoTokenManager.getAccessTokenByCode, 응답값이 없습니다. code = {}", code); + throw new IllegalArgumentException(INVALID_CODE.getMessage()); + } ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(responseBody); return jsonNode.get("access_token").asText(); @@ -80,6 +84,7 @@ public StringBuilder getKakaoInfo(String socialToken) { br.close(); return result; } catch (IOException e) { + log.error("KakaoTokenManager.getKakaoInfo, e = {}, socialToken = {}", e.getMessage()); throw new IllegalArgumentException(FAILED_VALIDATE_KAKAO_LOGIN.getMessage()); } } diff --git a/src/main/java/com/sopterm/makeawish/service/social/KakaoLoginService.java b/src/main/java/com/sopterm/makeawish/service/social/KakaoLoginService.java index b4f6c445..d8c5ab1d 100644 --- a/src/main/java/com/sopterm/makeawish/service/social/KakaoLoginService.java +++ b/src/main/java/com/sopterm/makeawish/service/social/KakaoLoginService.java @@ -39,7 +39,8 @@ public AuthSignInResponseDTO socialLogin(String code, String redirectUri) { String kakaoAccessToken = null; try { kakaoAccessToken = kakaoTokenManager.getAccessTokenByCode(code, redirectUri); - } catch (JsonProcessingException j) { + } catch (JsonProcessingException e) { + log.error("KakaoLoginService.socialLogin, code = {}, redirectUri = {}, e = {}", code, redirectUri, e.getMessage()); throw new IllegalArgumentException(CODE_PARSE_ERROR.getMessage()); } val kakaoInfo = kakaoTokenManager.getKakaoInfo(kakaoAccessToken); diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..9a591310 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,42 @@ + + + + + + + + + ${CONSOLE_PATTERN} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file