aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-01-26 21:43:38 +0300
committerGravatar Vitaly Takmazov2016-01-26 21:43:38 +0300
commit58fb4a6394cb19ee04e65d0e921cdf0ae6fdb6e3 (patch)
tree63e50cebe6e2fb900cc3297f5e2af09a7169fc95 /src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
parente5dba294763f40a5e3fd8e997d4ea3f507142924 (diff)
s2s: logging
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionOut.java')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionOut.java23
1 files changed, 10 insertions, 13 deletions
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("<db:verify from='" + XMPPComponent.HOSTNAME + "' to='" + to + "' id='" + sid + "'>" + key + "</db:verify>");
} catch (IOException e) {
- System.err.println("STREAM TO " + to + " " + streamID + " ERROR: " + e.toString());
+ LOGGER.warning("STREAM TO " + to + " " + streamID + " ERROR: " + e.toString());
}
}
}