Skip to content

Commit d8ce7ca

Browse files
committed
Change logger
1 parent 0db9b2b commit d8ce7ca

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

spar-wings-sns-notification/src/main/java/jp/xet/sparwings/aws/sns/NotificationService.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Map;
2424

2525
import lombok.RequiredArgsConstructor;
26+
import lombok.extern.slf4j.Slf4j;
2627
import org.springframework.beans.factory.InitializingBean;
2728
import org.springframework.beans.factory.annotation.Autowired;
2829
import org.springframework.beans.factory.annotation.Value;
@@ -46,12 +47,10 @@
4647
* @since 0.3
4748
* @author daisuke
4849
*/
50+
@Slf4j
4951
@RequiredArgsConstructor
5052
public class NotificationService implements InitializingBean {
5153

52-
private static Logger logger = LoggerFactory.getLogger(NotificationService.class);
53-
54-
5554
/**
5655
* Returns stacktrace as string.
5756
*
@@ -94,8 +93,8 @@ private static String toString(Throwable t) {
9493

9594
@Override
9695
public void afterPropertiesSet() {
97-
logger.info("Initialize devTopicArn = {}", devTopicArn);
98-
logger.info("Initialize opsTopicArn = {}", opsTopicArn);
96+
log.info("Initialize devTopicArn = {}", devTopicArn);
97+
log.info("Initialize opsTopicArn = {}", opsTopicArn);
9998
}
10099

101100
/**
@@ -200,23 +199,23 @@ private void notifyMessage0(String topicArn, String originalSubject, String mess
200199
String subject = String.format(Locale.ENGLISH, "[%s:%s] %s (%s)",
201200
appCodeName, stackName, originalSubject, env.getActiveProfilesAsString());
202201
if (subject.length() > 100) {
203-
logger.warn("Topic message subject is truncated. Full subject is: {}", subject);
202+
log.warn("Topic message subject is truncated. Full subject is: {}", subject);
204203
subject = subject.substring(0, 100);
205204
}
206205

207-
logger.debug("notify message to topic[{}] - {} : {}", topicArn, subject, message);
206+
log.debug("notify message to topic[{}] - {} : {}", topicArn, subject, message);
208207
if (topicArn == null || topicArn.isEmpty() || topicArn.equals("arn:aws:sns:null")) {
209-
logger.debug("topicArn: NULL");
208+
log.debug("topicArn: NULL");
210209
return;
211210
}
212211
try {
213212
sns.publish(new PublishRequest()
214213
.withTopicArn(topicArn)
215214
.withSubject(subject)
216215
.withMessage(message));
217-
logger.debug("SNS Notification published: {} - {}", topicArn, subject);
216+
log.debug("SNS Notification published: {} - {}", topicArn, subject);
218217
} catch (Exception e) { // NOPMD
219-
logger.error("SNS Publish failed: {} - {} - {}", topicArn, subject, message, e);
218+
log.error("SNS Publish failed: {} - {} - {}", topicArn, subject, message, e);
220219
}
221220
}
222221
}

0 commit comments

Comments
 (0)