Skip to content

Commit 4e933b4

Browse files
committed
Polish log messages
1 parent 6e30851 commit 4e933b4

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public Map<String, List<String>> toNativeHeaderMap() {
195195
result.put(name, Arrays.asList(subscriptionId));
196196
}
197197
else {
198-
logger.warn(getCommand() + " frame should have a subscription: " + this.toString());
198+
logger.warn(getCommand() + " frame does not have a subscription identifier" + this.toString());
199199
}
200200
}
201201

spring-messaging/src/main/java/org/springframework/messaging/support/AbstractSubscribableChannel.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@ public abstract class AbstractSubscribableChannel extends AbstractMessageChannel
2929

3030
@Override
3131
public final boolean subscribe(MessageHandler handler) {
32-
if (hasSubscription(handler)) {
33-
logger.warn("[" + getBeanName() + "] handler already subscribed " + handler);
34-
return false;
32+
boolean result = subscribeInternal(handler);
33+
if (result) {
34+
if (logger.isDebugEnabled()) {
35+
logger.debug("[" + getBeanName() + "] subscribed " + handler);
36+
}
3537
}
36-
if (logger.isDebugEnabled()) {
37-
logger.debug("[" + getBeanName() + "] subscribing " + handler);
38-
}
39-
return subscribeInternal(handler);
38+
return result;
4039
}
4140

4241
@Override
4342
public final boolean unsubscribe(MessageHandler handler) {
44-
if (logger.isDebugEnabled()) {
45-
logger.debug("[" + getBeanName() + "] unsubscribing " + handler);
43+
boolean result = unsubscribeInternal(handler);
44+
if (result) {
45+
if (logger.isDebugEnabled()) {
46+
logger.debug("[" + getBeanName() + "] unsubscribed " + handler);
47+
}
4648
}
47-
return unsubscribeInternal(handler);
49+
return result;
4850
}
4951

5052

0 commit comments

Comments
 (0)