From 58504fd85acef9c0c8b5c6001d96db47ac73c9e4 Mon Sep 17 00:00:00 2001 From: jihoon-jang Date: Sat, 21 Oct 2023 15:48:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=EB=B0=8F=20=EB=AC=B8=EA=B5=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/entity/NotificationType.java | 2 +- .../global/infra/firebase/FirebaseCloudMessageService.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/polzzak/domain/notification/entity/NotificationType.java b/src/main/java/com/polzzak/domain/notification/entity/NotificationType.java index 2dd24d9..78f167a 100644 --- a/src/main/java/com/polzzak/domain/notification/entity/NotificationType.java +++ b/src/main/java/com/polzzak/domain/notification/entity/NotificationType.java @@ -42,7 +42,7 @@ public String getParameterWithoutBold(final String parameter) { if (this == STAMP_REQUEST || this == REWARD_REQUEST || this == STAMP_BOARD_COMPLETE || this == REWARDED || this == REWARD_REQUEST_AGAIN || this == REWARD_FAIL || this == CREATED_STAMP_BOARD || this == ISSUED_COUPON || this == REWARDED_REQUEST) { - return String.format(this.message, "'" + parameter + "'"); + return String.format(this.message, parameter); } return String.format(this.message, parameter); } diff --git a/src/main/java/com/polzzak/global/infra/firebase/FirebaseCloudMessageService.java b/src/main/java/com/polzzak/global/infra/firebase/FirebaseCloudMessageService.java index 98c601c..e28998e 100644 --- a/src/main/java/com/polzzak/global/infra/firebase/FirebaseCloudMessageService.java +++ b/src/main/java/com/polzzak/global/infra/firebase/FirebaseCloudMessageService.java @@ -18,8 +18,10 @@ import com.polzzak.domain.user.entity.Member; import lombok.RequiredArgsConstructor; +import lombok.extern.log4j.Log4j2; @Service +@Log4j2 @RequiredArgsConstructor public class FirebaseCloudMessageService { @@ -51,15 +53,16 @@ public void sendPushNotification(Member member, String title, String body, Strin .putData("link", link) .build(); BatchResponse response = null; + log.info("push. token: {}, title: {}, body: {}, link: {}", registrationTokens, title, body, link); try { response = FirebaseMessaging.getInstance().sendEachForMulticast(message); } catch (FirebaseMessagingException e) { + log.warn("fail push."); e.printStackTrace(); } // See the BatchResponse reference documentation // for the contents of response. - System.out.println(response.getSuccessCount() + " messages were sent successfully"); - System.out.println(response); + log.info(response.getSuccessCount() + " messages were sent successfully"); } catch (Exception e) {