diff options
author | Vitaly Takmazov | 2016-01-26 21:43:38 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-01-26 21:43:38 +0300 |
commit | 58fb4a6394cb19ee04e65d0e921cdf0ae6fdb6e3 (patch) | |
tree | 63e50cebe6e2fb900cc3297f5e2af09a7169fc95 /src/main/java/com/juick/xmpp/s2s/ConnectionIn.java | |
parent | e5dba294763f40a5e3fd8e997d4ea3f507142924 (diff) |
s2s: logging
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionIn.java')
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/ConnectionIn.java | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java index f484c9db..fad97c16 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java @@ -37,7 +37,7 @@ public class ConnectionIn extends Connection implements Runnable { @Override public void run() { - System.out.println("STREAM FROM ? " + streamID + " START"); + LOGGER.info("STREAM FROM ? " + streamID + " START"); try { parser.setInput(new InputStreamReader(socket.getInputStream())); writer = new OutputStreamWriter(socket.getOutputStream()); @@ -67,10 +67,7 @@ public class ConnectionIn extends Connection implements Runnable { if (parser.getEventType() != XmlPullParser.START_TAG) { continue; } - - if (XMPPComponent.LOGFILE != null) { - logParser(); - } + logParser(); packetsRemote++; @@ -78,7 +75,7 @@ public class ConnectionIn extends Connection implements Runnable { if (tag.equals("db:result")) { String dfrom = parser.getAttributeValue(null, "from"); String to = parser.getAttributeValue(null, "to"); - System.out.println("STREAM FROM " + dfrom + " TO " + to + " " + streamID + " ASKING FOR DIALBACK"); + LOGGER.info("STREAM FROM " + dfrom + " TO " + to + " " + streamID + " ASKING FOR DIALBACK"); if (dfrom.endsWith(XMPPComponent.HOSTNAME) && (dfrom.equals(XMPPComponent.HOSTNAME) || dfrom.endsWith("." + XMPPComponent.HOSTNAME))) { break; } @@ -109,10 +106,10 @@ public class ConnectionIn extends Connection implements Runnable { } if (valid) { sendStanza("<db:verify from='" + vto + "' to='" + vfrom + "' id='" + vid + "' type='valid'/>"); - System.out.println("STREAM FROM " + vfrom + " " + streamID + " DIALBACK VERIFY VALID"); + LOGGER.info("STREAM FROM " + vfrom + " " + streamID + " DIALBACK VERIFY VALID"); } else { sendStanza("<db:verify from='" + vto + "' to='" + vfrom + "' id='" + vid + "' type='invalid'/>"); - System.err.println("STREAM FROM " + vfrom + " " + streamID + " DIALBACK VERIFY INVALID"); + LOGGER.warning("STREAM FROM " + vfrom + " " + streamID + " DIALBACK VERIFY INVALID"); } } else if (tag.equals("presence") && checkFromTo(parser)) { Presence p = Presence.parse(parser, null); @@ -123,7 +120,7 @@ public class ConnectionIn extends Connection implements Runnable { updateTsRemoteData(); Message msg = Message.parse(parser, XMPPComponent.childParsers); if (msg != null && (msg.type == null || !msg.type.equals(Message.Type.error))) { - System.out.println("STREAM " + streamID + ": " + msg.toString()); + LOGGER.info("STREAM " + streamID + ": " + msg.toString()); if (!JuickBot.incomingMessage(msg)) { XMPPComponent.connRouter.sendStanza(msg.toString()); } @@ -133,14 +130,14 @@ public class ConnectionIn extends Connection implements Runnable { String type = parser.getAttributeValue(null, "type"); String xml = XmlUtils.parseToString(parser, true); if (type == null || !type.equals(Iq.Type.error)) { - System.out.println("STREAM " + streamID + ": " + xml); + LOGGER.info("STREAM " + streamID + ": " + xml); XMPPComponent.connRouter.sendStanza(xml); } } else { - System.out.println("STREAM " + streamID + ": " + XmlUtils.parseToString(parser, true)); + LOGGER.info("STREAM " + streamID + ": " + XmlUtils.parseToString(parser, true)); } } - System.err.println("STREAM " + streamID + " FINISHED"); + LOGGER.warning("STREAM " + streamID + " FINISHED"); XMPPComponent.removeConnectionIn(this); closeConnection(); } catch (EOFException ex) { @@ -148,7 +145,7 @@ public class ConnectionIn extends Connection implements Runnable { XMPPComponent.removeConnectionIn(this); closeConnection(); } catch (Exception e) { - System.err.println("STREAM " + streamID + " ERROR:" + e.toString()); + LOGGER.warning("STREAM " + streamID + " ERROR:" + e.toString()); e.printStackTrace(); XMPPComponent.removeConnectionIn(this); closeConnection(); @@ -164,10 +161,10 @@ public class ConnectionIn extends Connection implements Runnable { sendStanza("<db:result from='" + XMPPComponent.HOSTNAME + "' to='" + sfrom + "' type='" + type + "'/>"); if (type.equals("valid")) { from.add(sfrom); - System.out.println("STREAM FROM " + sfrom + " " + streamID + " READY"); + LOGGER.info("STREAM FROM " + sfrom + " " + streamID + " READY"); } } catch (IOException e) { - System.err.println("STREAM FROM " + sfrom + " " + streamID + " ERROR: " + e.toString()); + LOGGER.warning("STREAM FROM " + sfrom + " " + streamID + " ERROR: " + e.toString()); } } |