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/ConnectionOut.java | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionOut.java') diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java index 2626b926..0205349a 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java @@ -32,7 +32,7 @@ public class ConnectionOut extends Connection implements Runnable { @Override public void run() { - System.out.println("STREAM TO " + to + " START"); + LOGGER.info("STREAM TO " + to + " START"); try { HostnamePort addr = DNSQueries.getServerAddress(to); @@ -51,7 +51,7 @@ public class ConnectionOut extends Connection implements Runnable { throw new Exception("STREAM TO " + to + " INVALID FIRST PACKET"); } - System.out.println("STREAM TO " + to + " " + streamID + " OPEN"); + LOGGER.info("STREAM TO " + to + " " + streamID + " OPEN"); XMPPComponent.addConnectionOut(this); if (checkSID != null) { @@ -64,26 +64,23 @@ public class ConnectionOut extends Connection implements Runnable { if (parser.getEventType() != XmlPullParser.START_TAG) { continue; } - - if (XMPPComponent.LOGFILE != null) { - logParser(); - } + logParser(); String tag = parser.getName(); if (tag.equals("db:result")) { String type = parser.getAttributeValue(null, "type"); if (type != null && type.equals("valid")) { streamReady = true; - System.out.println("STREAM TO " + to + " " + streamID + " READY"); + LOGGER.info("STREAM TO " + to + " " + streamID + " READY"); String cache = XMPPComponent.getFromCache(to); if (cache != null) { - System.out.println("STREAM TO " + to + " " + streamID + " SENDING CACHE"); + LOGGER.info("STREAM TO " + to + " " + streamID + " SENDING CACHE"); sendStanza(cache); } } else { - System.out.println("STREAM TO " + to + " " + streamID + " DIALBACK FAIL"); + LOGGER.info("STREAM TO " + to + " " + streamID + " DIALBACK FAIL"); } XmlUtils.skip(parser); } else if (tag.equals("db:verify")) { @@ -98,15 +95,15 @@ public class ConnectionOut extends Connection implements Runnable { } XmlUtils.skip(parser); } else { - System.out.println("STREAM TO " + to + " " + streamID + ": " + XmlUtils.parseToString(parser, true)); + LOGGER.info("STREAM TO " + to + " " + streamID + ": " + XmlUtils.parseToString(parser, true)); } } - System.err.println("STREAM TO " + to + " " + streamID + " FINISHED"); + LOGGER.warning("STREAM TO " + to + " " + streamID + " FINISHED"); XMPPComponent.removeConnectionOut(this); closeConnection(); } catch (Exception e) { - System.err.println(e.toString()); + LOGGER.warning(e.toString()); XMPPComponent.removeConnectionOut(this); closeConnection(); } @@ -116,7 +113,7 @@ public class ConnectionOut extends Connection implements Runnable { try { sendStanza("" + key + ""); } catch (IOException e) { - System.err.println("STREAM TO " + to + " " + streamID + " ERROR: " + e.toString()); + LOGGER.warning("STREAM TO " + to + " " + streamID + " ERROR: " + e.toString()); } } } -- cgit v1.2.3