Skip to content

Commit af900e1

Browse files
committed
refactor: 로그 메시지에서 이모지 제거
- 프로덕션 환경에서의 로그 안정성 개선 - 로그 분석 도구 호환성 향상 - 인코딩 이슈 방지 변경된 파일: - RankingAggregator: 배치 점수 반영, 점수 증가 로그 - RankingScheduler: 콜드 스타트 스케줄러 로그 - CatalogEventConsumer: Catalog 이벤트 처리 로그 - OrderEventConsumer: Order 이벤트 처리 로그 - RankingService: 랭킹 조회 로그 - RankingFacade: 상품 정보 조합 로그
1 parent a32583f commit af900e1

6 files changed

Lines changed: 30 additions & 30 deletions

File tree

apps/commerce-api/src/main/java/com/loopers/application/ranking/RankingFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public List<RankingProductInfo> getDailyRanking(String date, int page, int size)
4848
ProductInfo product = productMap.get(item.getProductId());
4949

5050
if (product == null) {
51-
log.warn("⚠️ 랭킹에 있지만 상품 정보 없음 - productId: {}", item.getProductId());
51+
log.warn("랭킹에 있지만 상품 정보 없음 - productId: {}", item.getProductId());
5252
continue;
5353
}
5454

apps/commerce-api/src/main/java/com/loopers/application/ranking/RankingService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private List<RankingItem> getRanking(String key, int page, int size) {
9292
.reverseRangeWithScores(key, start, end);
9393

9494
if (results == null || results.isEmpty()) {
95-
log.debug("📊 랭킹 조회 결과 없음 - key: {}, page: {}, size: {}", key, page, size);
95+
log.debug("랭킹 조회 결과 없음 - key: {}, page: {}, size: {}", key, page, size);
9696
return List.of();
9797
}
9898

@@ -110,7 +110,7 @@ private List<RankingItem> getRanking(String key, int page, int size) {
110110
.build());
111111
}
112112

113-
log.info("📊 랭킹 조회 완료 - key: {}, page: {}, size: {}, count: {}",
113+
log.info("랭킹 조회 완료 - key: {}, page: {}, size: {}, count: {}",
114114
key, page, size, items.size());
115115

116116
return items;

apps/commerce-streamer/src/main/java/com/loopers/application/ranking/RankingAggregator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void incrementScoresBatch(Map<Long, Double> scoreMap) {
105105
redisTemplate.expire(dailyKey, TTL_DAILY);
106106
redisTemplate.expire(hourlyKey, TTL_HOURLY);
107107

108-
log.info("📊 배치 랭킹 점수 반영 완료 - count: {}, dailyKey: {}, hourlyKey: {}",
108+
log.info("배치 랭킹 점수 반영 완료 - count: {}, dailyKey: {}, hourlyKey: {}",
109109
scoreMap.size(), dailyKey, hourlyKey);
110110
}
111111

@@ -121,10 +121,10 @@ private void incrementScore(String key, Long productId, double score, Duration t
121121
// TTL 설정 (키가 처음 생성될 때)
122122
redisTemplate.expire(key, ttl);
123123

124-
log.debug("📈 랭킹 점수 증가 - key: {}, productId: {}, score: {:.2f}, newScore: {:.2f}",
124+
log.debug("랭킹 점수 증가 - key: {}, productId: {}, score: {:.2f}, newScore: {:.2f}",
125125
key, productId, score, newScore);
126126
} catch (Exception e) {
127-
log.error("랭킹 점수 증가 실패 - key: {}, productId: {}, score: {}",
127+
log.error("랭킹 점수 증가 실패 - key: {}, productId: {}, score: {}",
128128
key, productId, score, e);
129129
}
130130
}

apps/commerce-streamer/src/main/java/com/loopers/application/ranking/RankingScheduler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void prepareNextDayRanking() {
2929
String todayKey = RankingKey.dailyToday();
3030
String tomorrowKey = RankingKey.dailyTomorrow();
3131

32-
log.info("🔄 내일 랭킹 키 생성 시작 - today: {}, tomorrow: {}", todayKey, tomorrowKey);
32+
log.info("내일 랭킹 키 생성 시작 - today: {}, tomorrow: {}", todayKey, tomorrowKey);
3333

3434
// ZUNIONSTORE를 사용해 오늘 점수의 10%를 내일 키로 복사
3535
// destination key, numkeys, key1, weights, aggregate
@@ -43,14 +43,14 @@ public void prepareNextDayRanking() {
4343
// 가중치 0.1 적용 (모든 점수를 10%로 조정)
4444
multiplyAllScores(tomorrowKey, RankingScore.carryOverWeight());
4545

46-
log.info("내일 랭킹 키 생성 완료 - key: {}, count: {}, weight: {}",
46+
log.info("내일 랭킹 키 생성 완료 - key: {}, count: {}, weight: {}",
4747
tomorrowKey, result, RankingScore.carryOverWeight());
4848
} else {
49-
log.warn("⚠️ 오늘 랭킹 데이터가 없어 내일 키를 생성하지 않음 - todayKey: {}", todayKey);
49+
log.warn("오늘 랭킹 데이터가 없어 내일 키를 생성하지 않음 - todayKey: {}", todayKey);
5050
}
5151

5252
} catch (Exception e) {
53-
log.error("내일 랭킹 키 생성 실패", e);
53+
log.error("내일 랭킹 키 생성 실패", e);
5454
}
5555
}
5656

@@ -82,11 +82,11 @@ private void multiplyAllScores(String key, double weight) {
8282
return null;
8383
});
8484

85-
log.debug("🔢 점수 가중치 적용 완료 - key: {}, weight: {}, count: {}",
85+
log.debug("점수 가중치 적용 완료 - key: {}, weight: {}, count: {}",
8686
key, weight, entries.size());
8787

8888
} catch (Exception e) {
89-
log.error("점수 가중치 적용 실패 - key: {}", key, e);
89+
log.error("점수 가중치 적용 실패 - key: {}", key, e);
9090
}
9191
}
9292
}

apps/commerce-streamer/src/main/java/com/loopers/interfaces/consumer/CatalogEventConsumer.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void consumeCatalogEvents(
4343
List<ConsumerRecord<Object, Object>> records,
4444
Acknowledgment acknowledgment
4545
) {
46-
log.info("📦 Catalog 이벤트 수신 - count: {}", records.size());
46+
log.info("Catalog 이벤트 수신 - count: {}", records.size());
4747

4848
int successCount = 0;
4949
int skipCount = 0;
@@ -59,7 +59,7 @@ public void consumeCatalogEvents(
5959
}
6060
} catch (Exception e) {
6161
failCount++;
62-
log.error("이벤트 처리 실패 - partition: {}, offset: {}, key: {}, error: {}",
62+
log.error("이벤트 처리 실패 - partition: {}, offset: {}, key: {}, error: {}",
6363
record.partition(), record.offset(), record.key(), e.getMessage(), e);
6464

6565
// DLQ에 전송
@@ -70,7 +70,7 @@ public void consumeCatalogEvents(
7070
// Offset 커밋 (배치 단위)
7171
acknowledgment.acknowledge();
7272

73-
log.info("Catalog 이벤트 처리 완료 - success: {}, skip: {}, fail: {}, total: {}",
73+
log.info("Catalog 이벤트 처리 완료 - success: {}, skip: {}, fail: {}, total: {}",
7474
successCount, skipCount, failCount, records.size());
7575
}
7676

@@ -92,14 +92,14 @@ protected boolean processEvent(ConsumerRecord<Object, Object> record) throws Exc
9292
String aggregateId = (String) eventData.get("aggregateId");
9393

9494
if (eventId == null) {
95-
log.warn("⚠️ eventId가 없는 메시지 - partition: {}, offset: {}",
95+
log.warn("eventId가 없는 메시지 - partition: {}, offset: {}",
9696
record.partition(), record.offset());
9797
return false;
9898
}
9999

100100
// 1. 중복 체크 (Inbox)
101101
if (eventInboxService.isDuplicate(eventId)) {
102-
log.info("🔁 중복 이벤트 스킵 - eventId: {}, eventType: {}", eventId, eventType);
102+
log.info("중복 이벤트 스킵 - eventId: {}, eventType: {}", eventId, eventType);
103103
return false;
104104
}
105105

@@ -126,10 +126,10 @@ protected boolean processEvent(ConsumerRecord<Object, Object> record) throws Exc
126126
break;
127127

128128
default:
129-
log.warn("⚠️ 알 수 없는 이벤트 타입 - eventType: {}", eventType);
129+
log.warn("알 수 없는 이벤트 타입 - eventType: {}", eventType);
130130
}
131131

132-
log.info("이벤트 처리 완료 - eventId: {}, eventType: {}, productId: {}",
132+
log.info("이벤트 처리 완료 - eventId: {}, eventType: {}, productId: {}",
133133
eventId, eventType, productId);
134134

135135
return true;
@@ -153,7 +153,7 @@ private void sendToDLQ(ConsumerRecord<Object, Object> record, Exception error, i
153153
retryCount
154154
);
155155
} catch (Exception e) {
156-
log.error("DLQ 저장 실패 - error: {}", e.getMessage(), e);
156+
log.error("DLQ 저장 실패 - error: {}", e.getMessage(), e);
157157
}
158158
}
159159

apps/commerce-streamer/src/main/java/com/loopers/interfaces/consumer/OrderEventConsumer.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void consumeOrderEvents(
4242
List<ConsumerRecord<Object, Object>> records,
4343
Acknowledgment acknowledgment
4444
) {
45-
log.info("📦 Order 이벤트 수신 - count: {}", records.size());
45+
log.info("Order 이벤트 수신 - count: {}", records.size());
4646

4747
int successCount = 0;
4848
int skipCount = 0;
@@ -58,7 +58,7 @@ public void consumeOrderEvents(
5858
}
5959
} catch (Exception e) {
6060
failCount++;
61-
log.error("이벤트 처리 실패 - partition: {}, offset: {}, key: {}, error: {}",
61+
log.error("이벤트 처리 실패 - partition: {}, offset: {}, key: {}, error: {}",
6262
record.partition(), record.offset(), record.key(), e.getMessage(), e);
6363

6464
// DLQ에 전송
@@ -69,7 +69,7 @@ public void consumeOrderEvents(
6969
// Offset 커밋 (배치 단위)
7070
acknowledgment.acknowledge();
7171

72-
log.info("Order 이벤트 처리 완료 - success: {}, skip: {}, fail: {}, total: {}",
72+
log.info("Order 이벤트 처리 완료 - success: {}, skip: {}, fail: {}, total: {}",
7373
successCount, skipCount, failCount, records.size());
7474
}
7575

@@ -90,14 +90,14 @@ protected boolean processEvent(ConsumerRecord<Object, Object> record) throws Exc
9090
String aggregateId = (String) eventData.get("aggregateId");
9191

9292
if (eventId == null) {
93-
log.warn("⚠️ eventId가 없는 메시지 - partition: {}, offset: {}",
93+
log.warn("eventId가 없는 메시지 - partition: {}, offset: {}",
9494
record.partition(), record.offset());
9595
return false;
9696
}
9797

9898
// 1. 중복 체크 (Inbox)
9999
if (eventInboxService.isDuplicate(eventId)) {
100-
log.info("🔁 중복 이벤트 스킵 - eventId: {}, eventType: {}", eventId, eventType);
100+
log.info("중복 이벤트 스킵 - eventId: {}, eventType: {}", eventId, eventType);
101101
return false;
102102
}
103103

@@ -109,10 +109,10 @@ protected boolean processEvent(ConsumerRecord<Object, Object> record) throws Exc
109109
processOrderCreated(payload);
110110
} else if ("PaymentSuccessEvent".equals(eventType)) {
111111
// 추가 처리 로직 (필요 시)
112-
log.info("💰 결제 성공 이벤트 수신 - eventId: {}", eventId);
112+
log.info("결제 성공 이벤트 수신 - eventId: {}", eventId);
113113
}
114114

115-
log.info("이벤트 처리 완료 - eventId: {}, eventType: {}",
115+
log.info("이벤트 처리 완료 - eventId: {}, eventType: {}",
116116
eventId, eventType);
117117

118118
return true;
@@ -130,7 +130,7 @@ private void processOrderCreated(String payload) throws Exception {
130130
Object payloadObj = eventData.get("payload");
131131

132132
if (payloadObj == null) {
133-
log.warn("⚠️ payload가 없는 OrderCreatedEvent");
133+
log.warn("payload가 없는 OrderCreatedEvent");
134134
return;
135135
}
136136

@@ -158,7 +158,7 @@ private void processOrderCreated(String payload) throws Exception {
158158
int unitPrice = amount.divide(new BigDecimal(quantity), 0, BigDecimal.ROUND_HALF_UP).intValue();
159159
rankingAggregator.incrementOrderScore(productId, unitPrice, quantity);
160160
} else {
161-
log.warn("⚠️ OrderCreatedEvent에 필수 필드 누락 - productId: {}, quantity: {}, amount: {}",
161+
log.warn("OrderCreatedEvent에 필수 필드 누락 - productId: {}, quantity: {}, amount: {}",
162162
productIdObj, quantityObj, amountObj);
163163
}
164164
}
@@ -181,7 +181,7 @@ private void sendToDLQ(ConsumerRecord<Object, Object> record, Exception error, i
181181
retryCount
182182
);
183183
} catch (Exception e) {
184-
log.error("DLQ 저장 실패 - error: {}", e.getMessage(), e);
184+
log.error("DLQ 저장 실패 - error: {}", e.getMessage(), e);
185185
}
186186
}
187187

0 commit comments

Comments
 (0)