aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-10 04:50:07 +0700
committerGravatar Vitaly Takmazov2016-11-10 21:41:14 +0300
commit09221ab5695e99b2df1130ea923c39625ec85429 (patch)
tree58c775188d25239a1e32a83f8007e5f1679d49ee /juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
parent705d4f87c97dfa20eb6daa88b93ff124fa401b92 (diff)
using slf4j + logback for logging
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/XMPPConnection.java')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/XMPPConnection.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
index 0f2f75f6..8dffd388 100644
--- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
+++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
@@ -9,6 +9,8 @@ import com.juick.xmpp.Stream;
import com.juick.xmpp.StreamComponent;
import com.juick.xmpp.extensions.JuickMessage;
import org.apache.commons.lang3.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@@ -19,8 +21,6 @@ import java.io.IOException;
import java.net.Socket;
import java.util.List;
import java.util.concurrent.ExecutorService;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import java.util.stream.Collectors;
/**
@@ -29,7 +29,8 @@ import java.util.stream.Collectors;
*/
@Component
public class XMPPConnection implements Stream.StreamListener, Message.MessageListener {
- private static final Logger logger = Logger.getLogger(XMPPConnection.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(XMPPConnection.class);
+
@Inject
JdbcTemplate sql;
ExecutorService service;
@@ -52,7 +53,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
xmpp.addListener((Message.MessageListener) this);
service.submit(() -> xmpp.startParsing());
} catch (IOException e) {
- logger.log(Level.SEVERE, "XMPPConnection error", e);
+ logger.error("XMPPConnection error", e);
}
}
@@ -64,7 +65,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
@Override
public void onStreamFail(Exception ex) {
- logger.log(Level.SEVERE, "XMPP stream failed", ex);
+ logger.error("XMPP stream failed", ex);
}
@Override
@@ -99,7 +100,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
logger.info("sending pm to " + c.visitor.getUID());
c.session.sendMessage(new TextMessage(json));
} catch (IOException e) {
- logger.log(Level.WARNING, "ws error", e);
+ logger.warn("ws error", e);
}
});
}
@@ -118,7 +119,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
logger.info("sending message to " + c.visitor.getUID());
c.session.sendMessage(new TextMessage(json));
} catch (IOException e) {
- logger.log(Level.WARNING, "ws error", e);
+ logger.warn("ws error", e);
}
});
wsHandler.clients.stream().filter(c ->
@@ -128,7 +129,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
logger.info("sending message to legacy client " + c.visitor.getUID());
c.session.sendMessage(new TextMessage(json));
} catch (IOException e) {
- logger.log(Level.WARNING, "ws error", e);
+ logger.warn("ws error", e);
}
});
}
@@ -148,7 +149,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
logger.info("sending reply to " + c.visitor.getUID());
c.session.sendMessage(new TextMessage(json));
} catch (IOException e) {
- logger.log(Level.WARNING, "ws error", e);
+ logger.warn("ws error", e);
}
});
wsHandler.clients.stream().filter(c ->
@@ -158,7 +159,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
logger.info("sending reply to legacy client " + c.visitor.getUID());
c.session.sendMessage(new TextMessage(json));
} catch (IOException e) {
- logger.log(Level.WARNING, "ws error", e);
+ logger.warn("ws error", e);
}
});
}