Some new-style logging.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5516 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-11-07 01:50:58 +00:00
parent 93d36c045f
commit eeb87f0721
@@ -248,8 +248,7 @@ public class Connection implements NetEventHandler
buf.position(4); buf.position(4);
for (int ii = 0; ii < 8; ii++) { for (int ii = 0; ii < 8; ii++) {
if (hash[ii] != buf.get()) { if (hash[ii] != buf.get()) {
log.warning("Datagram failed hash check [connectionId=" + _connectionId + log.warning("Datagram failed hash check", "id", _connectionId, "source", source);
", source=" + source + "].");
return; return;
} }
} }
@@ -267,10 +266,10 @@ public class Connection implements NetEventHandler
_handler.handleMessage(msg); _handler.handleMessage(msg);
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
log.warning("Error reading datagram [error=" + cnfe + "]."); log.warning("Error reading datagram", "error", cnfe);
} catch (IOException ioe) { } catch (IOException ioe) {
log.warning("Error reading datagram [error=" + ioe + "]."); log.warning("Error reading datagram", "error", ioe);
} }
} }
@@ -310,8 +309,7 @@ public class Connection implements NetEventHandler
close(); close();
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
log.warning("Error reading message from socket [channel=" + log.warning("Error reading message from socket", "channel", _channel, "error", cnfe);
StringUtil.safeToString(_channel) + ", error=" + cnfe + "].");
// deal with the failure // deal with the failure
String errmsg = "Unable to decode incoming message."; String errmsg = "Unable to decode incoming message.";
networkFailure((IOException) new IOException(errmsg).initCause(cnfe)); networkFailure((IOException) new IOException(errmsg).initCause(cnfe));
@@ -320,8 +318,7 @@ public class Connection implements NetEventHandler
// don't log a warning for the ever-popular "the client dropped the connection" failure // don't log a warning for the ever-popular "the client dropped the connection" failure
String msg = ioe.getMessage(); String msg = ioe.getMessage();
if (msg == null || msg.indexOf("reset by peer") == -1) { if (msg == null || msg.indexOf("reset by peer") == -1) {
log.warning("Error reading message from socket [channel=" + log.warning("Error reading message from socket", "channel", _channel, "error", ioe);
StringUtil.safeToString(_channel) + ", error=" + ioe + "].");
} }
// deal with the failure // deal with the failure
networkFailure(ioe); networkFailure(ioe);
@@ -340,8 +337,7 @@ public class Connection implements NetEventHandler
if (isClosed()) { if (isClosed()) {
return true; return true;
} }
log.info("Disconnecting non-communicative client [conn=" + this + log.info("Disconnecting non-communicative client", "conn", this, "idle", idleMillis + "ms");
", idle=" + idleMillis + "ms].");
return true; return true;
} }
@@ -427,7 +423,7 @@ public class Connection implements NetEventHandler
try { try {
_channel.close(); _channel.close();
} catch (IOException ioe) { } catch (IOException ioe) {
log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "]."); log.warning("Error closing connection", "conn", this, "error", ioe);
} }
// clear out our references to prevent repeat closings // clear out our references to prevent repeat closings