From 9011b0713d38b02ae1c52fa3eb96eb2b411826ff Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 29 Jun 2012 12:05:15 -0700 Subject: [PATCH] Adding more logging --- .../websocket/api/WebSocketEventDriver.java | 17 +++++++++++++++++ .../server/WebSocketServerFactory.java | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/api/WebSocketEventDriver.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/api/WebSocketEventDriver.java index 2460cd24bf1..33a16bb9277 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/api/WebSocketEventDriver.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/api/WebSocketEventDriver.java @@ -3,6 +3,8 @@ package org.eclipse.jetty.websocket.api; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.annotations.WebSocket; import org.eclipse.jetty.websocket.frames.BaseFrame; import org.eclipse.jetty.websocket.frames.BinaryFrame; @@ -20,6 +22,7 @@ import org.eclipse.jetty.websocket.parser.Parser; */ public class WebSocketEventDriver implements Parser.Listener { + private static final Logger LOG = Log.getLogger(WebSocketEventDriver.class); private Object websocket; private WebSocketPolicy policy; private WebSocketConnection connection; @@ -67,6 +70,10 @@ public class WebSocketEventDriver implements Parser.Listener */ public void onConnect() { + if (LOG.isDebugEnabled()) + { + LOG.debug("{}.onConnect()",websocket.getClass().getSimpleName()); + } events.onConnect.call(websocket,connection); } @@ -80,6 +87,11 @@ public class WebSocketEventDriver implements Parser.Listener @Override public void onFrame(BaseFrame frame) { + if (LOG.isDebugEnabled()) + { + LOG.debug("{}.onFrame({})",websocket.getClass().getSimpleName(),frame); + } + // Specified Close Case if ((frame instanceof CloseFrame) && (events.onClose != null)) { @@ -139,6 +151,11 @@ public class WebSocketEventDriver implements Parser.Listener @Override public void onWebSocketException(WebSocketException e) { + if (LOG.isDebugEnabled()) + { + LOG.debug("{}.onWebSocketException({})",websocket.getClass().getSimpleName(),e); + } + if (events.onException != null) { events.onException.call(websocket,connection,e); diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java index 9afc80d0dfd..505af06cf9f 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java @@ -351,8 +351,9 @@ public class WebSocketServerFactory extends AbstractLifeCycle implements WebSock List extensions = initExtensions(request.getExtensions()); // Process (version specific) handshake response + LOG.debug("Handshake Response: {}",handshaker); handshaker.doHandshakeResponse(request,response,extensions); - LOG.debug("Connection: {}",connection); + LOG.debug("Handshake Complete: {}",connection); // Add connection addConnection(connection);