From 58fb4a6394cb19ee04e65d0e921cdf0ae6fdb6e3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 26 Jan 2016 21:43:38 +0300 Subject: s2s: logging --- .../java/com/juick/xmpp/s2s/ConnectionRouter.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java') diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java index d8ce0daf..4a1f6b16 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java @@ -26,7 +26,7 @@ public class ConnectionRouter extends Connection implements Runnable { @Override public void run() { - System.out.println("STREAM ROUTER START"); + LOGGER.info("STREAM ROUTER START"); try { socket = new Socket("localhost", 5347); @@ -53,7 +53,7 @@ public class ConnectionRouter extends Connection implements Runnable { throw new Exception("NO HANDSHAKE"); } XmlUtils.skip(parser); - System.out.println("STREAM ROUTER OPEN"); + LOGGER.info("STREAM ROUTER OPEN"); while (parser.next() != XmlPullParser.END_DOCUMENT) { if (parser.getEventType() != XmlPullParser.START_TAG) { @@ -68,7 +68,7 @@ public class ConnectionRouter extends Connection implements Runnable { if (jid.Host.equals(XMPPComponent.COMPONENTNAME)) { if (tag.equals("message")) { Message xmsg = Message.parse(parser, XMPPComponent.childParsers); - System.out.println("STREAM ROUTER (PROCESS): " + xmsg.toString()); + LOGGER.info("STREAM ROUTER (PROCESS): " + xmsg.toString()); JuickMessage jmsg = (JuickMessage) xmsg.getChild(JuickMessage.XMLNS); if (jmsg != null) { if (jid.Username != null && jid.Username.equals("recomm")) { @@ -84,23 +84,23 @@ public class ConnectionRouter extends Connection implements Runnable { } } else if (jid.Host.endsWith(XMPPComponent.HOSTNAME) && (jid.Host.equals(XMPPComponent.HOSTNAME) || jid.Host.endsWith("." + XMPPComponent.HOSTNAME))) { String xml = XmlUtils.parseToString(parser, true); - System.out.println("STREAM ROUTER: " + xml); + LOGGER.info("STREAM ROUTER: " + xml); } else { String xml = XmlUtils.parseToString(parser, true); - System.out.println("STREAM ROUTER (OUT): " + xml); + LOGGER.info("STREAM ROUTER (OUT): " + xml); XMPPComponent.sendOut(jid.Host, xml); } } else { - System.out.println("STREAM ROUTER (NO TO): " + XmlUtils.parseToString(parser, true)); + LOGGER.info("STREAM ROUTER (NO TO): " + XmlUtils.parseToString(parser, true)); } } else { - System.out.println("STREAM ROUTER: " + XmlUtils.parseToString(parser, true)); + LOGGER.info("STREAM ROUTER: " + XmlUtils.parseToString(parser, true)); } } - System.err.println("STREAM ROUTER FINISHED"); + LOGGER.warning("STREAM ROUTER FINISHED"); } catch (Exception e) { - System.err.println("STREAM ROUTER PARSE ERROR: " + e.toString()); + LOGGER.warning("STREAM ROUTER PARSE ERROR: " + e.toString()); } System.exit(0); } @@ -111,8 +111,8 @@ public class ConnectionRouter extends Connection implements Runnable { writer.write(xml); writer.flush(); } catch (IOException e) { - System.err.println("STREAM ROUTER ERROR: " + xml); - System.err.println("STREAM ROUTER ERROR: " + e.toString()); + LOGGER.warning("STREAM ROUTER ERROR: " + xml); + LOGGER.warning("STREAM ROUTER ERROR: " + e.toString()); System.exit(0); } } -- cgit v1.2.3