From 072b2517640ccbf0e263c8fed7b5221213a6b9f0 Mon Sep 17 00:00:00 2001 From: Evan Lindsay Date: Wed, 8 Nov 2017 15:06:02 -0800 Subject: [PATCH] Remove dependency on slf4j-api in favor of JUL --- build.gradle | 1 - .../connection/websocket/WebSocketConnection.java | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 7c4c6d0e..848820b8 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,6 @@ repositories { dependencies { compile "com.google.code.gson:gson:2.2.2" - compile "org.slf4j:slf4j-api:1.7.5" compile "com.pusher:java-websocket:1.4.1" testCompile "org.mockito:mockito-all:1.8.5" testCompile "org.powermock:powermock-module-junit4:1.4.11" diff --git a/src/main/java/com/pusher/client/connection/websocket/WebSocketConnection.java b/src/main/java/com/pusher/client/connection/websocket/WebSocketConnection.java index 938fca3c..b7db6450 100644 --- a/src/main/java/com/pusher/client/connection/websocket/WebSocketConnection.java +++ b/src/main/java/com/pusher/client/connection/websocket/WebSocketConnection.java @@ -10,12 +10,11 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import java.util.logging.Logger; import javax.net.ssl.SSLException; import com.pusher.java_websocket.handshake.ServerHandshake; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.google.gson.Gson; @@ -26,7 +25,7 @@ import com.pusher.client.util.Factory; public class WebSocketConnection implements InternalConnection, WebSocketListener { - private static final Logger log = LoggerFactory.getLogger(WebSocketConnection.class); + private static final Logger log = Logger.getLogger(WebSocketConnection.class.getName()); private static final Gson GSON = new Gson(); private static final String INTERNAL_EVENT_PREFIX = "pusher:"; @@ -147,7 +146,7 @@ public String getSocketId() { /* implementation detail */ private void updateState(final ConnectionState newState) { - log.debug("State transition requested, current [" + state + "], new [" + newState + "]"); + log.fine("State transition requested, current [" + state + "], new [" + newState + "]"); final ConnectionStateChange change = new ConnectionStateChange(state, newState); state = newState; @@ -263,7 +262,7 @@ public void run() { @Override public void onClose(final int code, final String reason, final boolean remote) { if (state == ConnectionState.DISCONNECTED || state == ConnectionState.RECONNECTING) { - log.error("Received close from underlying socket when already disconnected." + "Close code [" + log.warning("Received close from underlying socket when already disconnected." + "Close code [" + code + "], Reason [" + reason + "], Remote [" + remote + "]"); return; } @@ -354,7 +353,7 @@ synchronized void activity() { pingTimer = factory.getTimers().schedule(new Runnable() { @Override public void run() { - log.debug("Sending ping"); + log.fine("Sending ping"); sendMessage(PING_EVENT_SERIALIZED); schedulePongCheck(); } @@ -385,7 +384,7 @@ private synchronized void schedulePongCheck() { pongTimer = factory.getTimers().schedule(new Runnable() { @Override public void run() { - log.debug("Timed out awaiting pong from server - disconnecting"); + log.fine("Timed out awaiting pong from server - disconnecting"); underlyingConnection.removeWebSocketListener();