From f5cc72ffbb15f3b917fadabf79d820c0b56adffc Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Thu, 10 Nov 2016 02:07:40 +0700 Subject: logging over slf4j --- .../main/java/com/juick/components/XMPPServer.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'juick-xmpp/src/main/java/com/juick/components') diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java index e533ebaf..cb0ad450 100644 --- a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java +++ b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java @@ -10,6 +10,8 @@ import com.juick.xmpp.extensions.JuickMessage; import com.juick.xmpp.extensions.Nickname; import com.juick.xmpp.extensions.XOOB; import org.apache.commons.lang3.math.NumberUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; @@ -27,8 +29,6 @@ import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.util.*; import java.util.concurrent.ExecutorService; -import java.util.logging.Level; -import java.util.logging.Logger; /** * @@ -37,7 +37,7 @@ import java.util.logging.Logger; public class XMPPServer implements DisposableBean, Stream.StreamListener, Message.MessageListener, Iq.IqListener, Presence.PresenceListener { - private static final Logger logger = Logger.getLogger(XMPPServer.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(XMPPServer.class); public ExecutorService service; private StreamComponent router; @@ -83,7 +83,7 @@ public class XMPPServer implements DisposableBean, Stream.StreamListener, router.addListener((Iq.IqListener) this); router.startParsing(); } catch (IOException e) { - logger.log(Level.SEVERE, "router error", e); + logger.error("router error", e); } }); service.submit(() -> { @@ -96,14 +96,14 @@ public class XMPPServer implements DisposableBean, Stream.StreamListener, addConnectionIn(client); service.submit(client); } catch (Exception e) { - logger.log(Level.SEVERE, "s2s error", e); + logger.error("s2s error", e); } } }); service.submit(new CleaningUp(this)); } catch (Exception e) { - logger.log(Level.SEVERE, "XMPPComponent error", e); + logger.error("XMPPComponent error", e); } } @@ -193,7 +193,7 @@ public class XMPPServer implements DisposableBean, Stream.StreamListener, try { connOut.sendStanza(xml); } catch (IOException e) { - logger.warning("STREAM TO " + connOut.to + " " + connOut.streamID + " ERROR: " + e.toString()); + logger.warn("STREAM TO " + connOut.to + " " + connOut.streamID + " ERROR: " + e.toString()); } return; } @@ -218,7 +218,7 @@ public class XMPPServer implements DisposableBean, Stream.StreamListener, ConnectionOut connectionOut = new ConnectionOut(this, hostname); service.submit(connectionOut); } catch (CertificateException | UnrecoverableKeyException | NoSuchAlgorithmException | XmlPullParserException | KeyStoreException | KeyManagementException | IOException e) { - logger.log(Level.SEVERE, "s2s out error", e); + logger.error("s2s out error", e); } } } @@ -245,7 +245,7 @@ public class XMPPServer implements DisposableBean, Stream.StreamListener, try { closeRouterConnection(); } catch (IOException e) { - logger.log(Level.WARNING, "router warning", e); + logger.error("router warning", e); } service.shutdown(); logger.info("component destroyed"); @@ -435,7 +435,7 @@ public class XMPPServer implements DisposableBean, Stream.StreamListener, @Override public void onStreamFail(Exception ex) { - logger.log(Level.SEVERE, "STREAM ROUTER (FAIL)", ex); + logger.error("STREAM ROUTER (FAIL)", ex); } public StreamComponent getRouter() { -- cgit v1.2.3