diff --git a/src/main/java/com/book/backend/domain/message/mapper/MessageMapper.java b/src/main/java/com/book/backend/domain/message/mapper/MessageMapper.java index 01bc80b..109a1db 100644 --- a/src/main/java/com/book/backend/domain/message/mapper/MessageMapper.java +++ b/src/main/java/com/book/backend/domain/message/mapper/MessageMapper.java @@ -31,6 +31,7 @@ public class MessageMapper { public Message convertToMessage(MessageRequestDto dto) { log.trace("MessageMapper > convertToMessage()"); User user = userService.loadLoggedinUser(); + log.trace("convertToMessage() message 객체 생성 때의 userid", user.getUserId()); if (user == null) { throw new CustomException(ErrorCode.USER_NOT_FOUND); } diff --git a/src/main/java/com/book/backend/domain/message/service/MessageService.java b/src/main/java/com/book/backend/domain/message/service/MessageService.java index 3f07afc..c981d01 100644 --- a/src/main/java/com/book/backend/domain/message/service/MessageService.java +++ b/src/main/java/com/book/backend/domain/message/service/MessageService.java @@ -94,8 +94,9 @@ public MessageResponseDto saveMessage(MessageRequestDto messageRequestDto){ validateToken(token); // message DB에 저장 - log.trace("saveMessage() 유저 이름 : {}", userService.loadLoggedinUser()); + log.trace("saveMessage() userId : {}", userService.loadLoggedinUser().getUserId()); Message message = messageMapper.convertToMessage(messageRequestDto); + log.trace("saveMessage() message user : {}", message.getUser().getUserId()); try{ messageRepository.save(message); } catch (Exception e){ @@ -116,12 +117,13 @@ public void validateToken(String token) { // 토큰 유효성 검증 if (!jwtUtil.isValidToken(token, userDetails)) { + log.trace("validateToken() 토큰 유효성 검증 실패 !!"); throw new CustomException(ErrorCode.WRONG_JWT_TOKEN); } else { UsernamePasswordAuthenticationToken authenticated = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); SecurityContextHolder.getContext().setAuthentication(authenticated); - log.trace("validateToken() 유저 이름 : {}", userService.loadLoggedinUser()); + log.trace("validateToken() userid : {}", userService.loadLoggedinUser().getUserId()); } } } catch (ExpiredJwtException e) {