From 46402bc382a0627b648b593bcf052d4fe7728211 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 28 Aug 2020 05:46:07 -0500 Subject: [PATCH] Issue #5193 - Updating logging per review Signed-off-by: Joakim Erdfelt --- .../events/JettyAnnotatedEventDriver.java | 12 +++---- .../events/JettyListenerEventDriver.java | 34 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedEventDriver.java index 5bec0316252..56aa8d57b97 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedEventDriver.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedEventDriver.java @@ -92,7 +92,8 @@ public class JettyAnnotatedEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onBinaryFrame({}, {}) - events.onBinary={}", BufferUtil.toDetailString(buffer), fin, events.onBinary); + LOG.debug("onBinaryFrame({}, {}) - events.onBinary={}, activeMessage={}", + BufferUtil.toDetailString(buffer), fin, events.onBinary, activeMessage); } if (events.onBinary == null) @@ -254,7 +255,8 @@ public class JettyAnnotatedEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onTextFrame({}, {}) - events.onText={}", BufferUtil.toDetailString(buffer), fin, events.onText); + LOG.debug("onTextFrame({}, {}) - events.onText={}, activeMessage={}", + BufferUtil.toDetailString(buffer), fin, events.onText, activeMessage); } if (events.onText == null) @@ -303,10 +305,8 @@ public class JettyAnnotatedEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - if (message == null) - LOG.debug("onTextMessage() - events.onText={}", events.onText); - else - LOG.debug("onTextMessage([{}] \"{}\") - events.onText={}", message.length(), TextUtil.maxStringLength(60, message), events.onText); + LOG.debug("onTextMessage([{}] \"{}\") - events.onText={}", + message.length(), TextUtil.maxStringLength(60, message), events.onText); } if (events.onText != null) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java index fcf85a1a594..dc9ed1059c3 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java @@ -73,11 +73,12 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onBinaryFrame({}, {}) - webSocketListener:{}, webSocketPartialListener:{}, listener:{}", + LOG.debug("onBinaryFrame({}, {}) - webSocketListener={}, webSocketPartialListener={}, listener={}, activeMessage={}", BufferUtil.toDetailString(buffer), fin, (listener instanceof WebSocketListener), (listener instanceof WebSocketPartialListener), - listener.getClass().getName()); + listener.getClass().getName(), + activeMessage); } if (listener instanceof WebSocketListener) @@ -116,7 +117,7 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onBinaryMessage([{}]) - webSocketListener:{}, listener:{}", + LOG.debug("onBinaryMessage([{}]) - webSocketListener={}, listener={}", data.length, (listener instanceof WebSocketListener), this.listener.getClass().getName()); @@ -143,7 +144,7 @@ public class JettyListenerEventDriver extends AbstractEventDriver if (LOG.isDebugEnabled()) { - LOG.debug("onClose({},{}) - listener:{}", statusCode, reason, this.listener.getClass().getName()); + LOG.debug("onClose({},{}) - listener={}", statusCode, reason, this.listener.getClass().getName()); } listener.onWebSocketClose(statusCode, reason); } @@ -153,7 +154,7 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onConnect({}) - listener:{}", session, this.listener.getClass().getName()); + LOG.debug("onConnect({}) - listener={}", session, this.listener.getClass().getName()); } listener.onWebSocketConnect(session); } @@ -163,7 +164,7 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onError({}) - listener:{}", cause.getClass().getName(), this.listener.getClass().getName()); + LOG.debug("onError({}) - listener={}", cause.getClass().getName(), this.listener.getClass().getName()); } listener.onWebSocketError(cause); } @@ -173,7 +174,7 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onFrame({}) - frameListener:{}, pingPongListener:{}, listener:{}", + LOG.debug("onFrame({}) - frameListener={}, pingPongListener={}, listener={}", frame, (listener instanceof WebSocketFrameListener), (listener instanceof WebSocketPingPongListener), @@ -215,12 +216,13 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onTextFrame({}, {}) - webSocketListener:{}, webSocketPartialListener:{}, listener:{}", + LOG.debug("onTextFrame({}, {}) - webSocketListener={}, webSocketPartialListener={}, listener={}, activeMessage={}", BufferUtil.toDetailString(buffer), fin, (listener instanceof WebSocketListener), (listener instanceof WebSocketPartialListener), - listener.getClass().getName()); + listener.getClass().getName(), + activeMessage); } if (listener instanceof WebSocketListener) @@ -282,12 +284,9 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - String msgDetail = message == null - ? "" - : String.format("[%d] \"%s\"", message.length(), TextUtil.maxStringLength(60, message)); - - LOG.debug("onTextMessage({}) - webSocketListener:{} listener:{}", - msgDetail, + LOG.debug("onTextMessage([{}] \"{}\") - webSocketListener={}, listener={}", + message.length(), + TextUtil.maxStringLength(60, message), (listener instanceof WebSocketListener), listener.getClass().getName()); } @@ -302,11 +301,12 @@ public class JettyListenerEventDriver extends AbstractEventDriver { if (LOG.isDebugEnabled()) { - LOG.debug("onContinuationFrame({}, {}) - webSocketListener:{}, webSocketPartialListener:{}, listener:{}", + LOG.debug("onContinuationFrame({}, {}) - webSocketListener={}, webSocketPartialListener={}, listener={}, activeMessage={}", BufferUtil.toDetailString(buffer), fin, (listener instanceof WebSocketListener), (listener instanceof WebSocketPartialListener), - listener.getClass().getName()); + listener.getClass().getName(), + activeMessage); } if (listener instanceof WebSocketPartialListener)