Skip to content

Commit d4e1e12

Browse files
committed
fix: null 방어 로직 추가
1 parent 5094d67 commit d4e1e12

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/eatda/config/LoggingInterceptor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ public void afterCompletion(
3434
Exception ex
3535
) {
3636
Long startTime = (Long) request.getAttribute(START_TIME);
37-
long duration = System.currentTimeMillis() - startTime;
37+
if (startTime == null) {
38+
log.warn("[Response] {} {} (duration unknown - preHandle not called)",
39+
request.getMethod(), request.getRequestURI());
40+
MDC.clear();
41+
return;
42+
}
3843

44+
long duration = System.currentTimeMillis() - startTime;
3945
log.info("[Response] {} {} ({}ms)", request.getMethod(), request.getRequestURI(), duration);
4046
MDC.clear();
4147
}

0 commit comments

Comments
 (0)