refactor: downgrade unhandled notification logging from error to warn

- Change logger.error() to logger.warn() for unhandled notification methods
- Log full notification object instead of just method name for better context
- Affects McpClientSession, McpServerSession, and McpStreamableServerSession

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Christian Tzolov 2025-08-06 08:34:30 +01:00
commit 110a8d1940
3 changed files with 3 additions and 3 deletions

View file

@ -221,7 +221,7 @@ public class McpClientSession implements McpSession {
return Mono.defer(() -> {
var handler = notificationHandlers.get(notification.method());
if (handler == null) {
logger.error("No handler registered for notification method: {}", notification.method());
logger.warn("No handler registered for notification method: {}", notification);
return Mono.empty();
}
return handler.handle(notification.params());

View file

@ -294,7 +294,7 @@ public class McpServerSession implements McpLoggableSession {
var handler = notificationHandlers.get(notification.method());
if (handler == null) {
logger.error("No handler registered for notification method: {}", notification.method());
logger.warn("No handler registered for notification method: {}", notification);
return Mono.empty();
}
return this.exchangeSink.asMono().flatMap(exchange -> handler.handle(exchange, notification.params()));

View file

@ -197,7 +197,7 @@ public class McpStreamableServerSession implements McpLoggableSession {
McpTransportContext transportContext = ctx.getOrDefault(McpTransportContext.KEY, McpTransportContext.EMPTY);
McpNotificationHandler notificationHandler = this.notificationHandlers.get(notification.method());
if (notificationHandler == null) {
logger.error("No handler registered for notification method: {}", notification.method());
logger.warn("No handler registered for notification method: {}", notification);
return Mono.empty();
}
McpLoggableSession listeningStream = this.listeningStreamRef.get();