aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp/s2s/Connection.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/Connection.java
parente5dba294763f40a5e3fd8e997d4ea3f507142924 (diff)
s2s: logging
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/Connection.java')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/Connection.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/Connection.java b/src/main/java/com/juick/xmpp/s2s/Connection.java
index 699e52bf..6d32abbe 100644
--- a/src/main/java/com/juick/xmpp/s2s/Connection.java
+++ b/src/main/java/com/juick/xmpp/s2s/Connection.java
@@ -5,6 +5,7 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.Date;
+import java.util.logging.Logger;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.xmlpull.mxp1.MXParser;
@@ -16,6 +17,8 @@ import org.xmlpull.v1.XmlPullParser;
*/
public class Connection {
+ protected static final Logger LOGGER = Logger.getLogger(Connection.class.getName());
+
public String streamID;
public long tsCreated = 0;
public long tsLocalData = 0;
@@ -29,15 +32,6 @@ public class Connection {
tsCreated = System.currentTimeMillis();
}
- public void logXml(String xml) {
- try {
- FileWriter logFile = new FileWriter(XMPPComponent.LOGFILE, true);
- logFile.write(new Date().toString() + "\t" + streamID + "\t" + xml);
- logFile.close();
- } catch (IOException e) {
- }
- }
-
public void logParser() {
if (streamID == null) {
return;
@@ -47,12 +41,12 @@ public class Connection {
tag += " " + parser.getAttributeName(i) + "=\"" + parser.getAttributeValue(i) + "\"";
}
tag += ">...</" + parser.getName() + ">\n";
- logXml(tag);
+ LOGGER.fine(tag);
}
public void sendStanza(String xml) throws IOException {
- if (XMPPComponent.LOGFILE != null && streamID != null) {
- logXml("OUT: " + xml + "\n");
+ if (streamID != null) {
+ LOGGER.fine("OUT: " + xml + "\n");
}
writer.write(xml);
writer.flush();
@@ -62,8 +56,8 @@ public class Connection {
}
void closeConnection() {
- if (XMPPComponent.LOGFILE != null && streamID != null) {
- logXml("CLOSING STREAM\n");
+ if (streamID != null) {
+ LOGGER.info(String.format("CLOSING STREAM %s", streamID));
}
try {