diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java index 9dc3800378..9d11893493 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java @@ -429,7 +429,8 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor { @Override public String getDetailedLogMessage(@Nullable Object payload) { if (isHeartbeat()) { - return "heart-beat in session " + getSessionId(); + String sessionId = getSessionId(); + return "heart-beat" + (sessionId != null ? " in session " + sessionId : ""); } StompCommand command = getCommand(); if (command == null) {