logging
This commit is contained in:
@ -157,6 +157,7 @@ public class OutNetMessage {
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Error serializing the I2NPMessage for the OutNetMessage", ioe);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -237,14 +238,16 @@ public class OutNetMessage {
|
||||
|
||||
public void finalize() throws Throwable {
|
||||
if (_message != null) {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("Undiscarded ").append(_messageSize).append("byte ");
|
||||
buf.append(_messageType).append(" message created ");
|
||||
buf.append((_context.clock().now() - _created)).append("ms ago: ");
|
||||
buf.append(_messageId); // .append(" to ").append(_target.calculateHash().toBase64());
|
||||
buf.append(", timing - \n");
|
||||
renderTimestamps(buf);
|
||||
_log.error(buf.toString(), _createdBy);
|
||||
if (_log.shouldLog(Log.WARN)) {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("Undiscarded ").append(_messageSize).append("byte ");
|
||||
buf.append(_messageType).append(" message created ");
|
||||
buf.append((_context.clock().now() - _created)).append("ms ago: ");
|
||||
buf.append(_messageId); // .append(" to ").append(_target.calculateHash().toBase64());
|
||||
buf.append(", timing - \n");
|
||||
renderTimestamps(buf);
|
||||
_log.warn(buf.toString(), _createdBy);
|
||||
}
|
||||
_context.messageStateMonitor().outboundMessageDiscarded();
|
||||
}
|
||||
_context.messageStateMonitor().outboundMessageFinalized();
|
||||
|
@ -70,6 +70,7 @@ public class OutboundMessageRegistry {
|
||||
long continueTime = 0;
|
||||
int numMessages = messages.size();
|
||||
|
||||
StringBuffer slow = new StringBuffer(256);
|
||||
long afterSync1 = _context.clock().now();
|
||||
|
||||
ArrayList matchedRemove = null; // new ArrayList(32);
|
||||
@ -86,6 +87,8 @@ public class OutboundMessageRegistry {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Matching with selector took too long (" + diff + "ms) : "
|
||||
+ selector.getClass().getName());
|
||||
slow.append(selector.getClass().getName()).append(": ");
|
||||
slow.append(diff).append(" ");
|
||||
}
|
||||
matchTime += diff;
|
||||
|
||||
@ -134,11 +137,17 @@ public class OutboundMessageRegistry {
|
||||
if (delay > 1000)
|
||||
level = Log.ERROR;
|
||||
if (_log.shouldLog(level)) {
|
||||
_log.log(level, "getMessages took " + delay + "ms with search time of "
|
||||
+ search + "ms (match: " + matchTime + "ms, continue: "
|
||||
+ continueTime + "ms, #: " + numMessages + ") and sync time of "
|
||||
+ sync + "ms for " + (matchedRemove == null ? 0 : matchedRemove.size())
|
||||
+ " removed, " + matches.size() + " matches");
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("getMessages took ").append(delay).append("ms with search time of");
|
||||
buf.append(search).append("ms (match: ").append(matchTime).append("ms, continue: ");
|
||||
buf.append(continueTime).append("ms, #: ").append(numMessages).append(") and sync time of ");
|
||||
buf.append(sync).append("ms for ");
|
||||
if (matchedRemove == null)
|
||||
buf.append(0);
|
||||
else
|
||||
buf.append(matchedRemove.size());
|
||||
buf.append(" removed, ").append(matches.size()).append(" matches: slow = ").append(slow.toString());
|
||||
_log.log(level, buf.toString());
|
||||
}
|
||||
|
||||
return matches;
|
||||
|
@ -166,8 +166,8 @@ class TCPListener {
|
||||
_log.debug("Handle successful");
|
||||
} else {
|
||||
if (h.receivedIdentByte()) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Unable to handle in the time allotted");
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Unable to handle in the time allotted");
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Peer didn't send the ident byte, so either they were testing us, or portscanning");
|
||||
|
@ -820,12 +820,12 @@ public class RequestTunnelJob extends JobImpl {
|
||||
public String getName() { return "Create Tunnel Failed"; }
|
||||
public void runJob() {
|
||||
// update the tunnel so its known to be not working
|
||||
if (_log.shouldLog(Log.ERROR)) {
|
||||
_log.error("Tunnel creation timed out for tunnel " + _tunnel.getTunnelId() + " at router "
|
||||
if (_log.shouldLog(Log.WARN)) {
|
||||
_log.warn("Tunnel creation timed out for tunnel " + _tunnel.getTunnelId() + " at router "
|
||||
+ _tunnel.getThisHop().toBase64() + " from router "
|
||||
+ _context.routerHash().toBase64() + " after waiting "
|
||||
+ (_context.clock().now()-_started) + "ms");
|
||||
_log.error("Added by", Failure.this.getAddedBy());
|
||||
_log.warn("Added by", Failure.this.getAddedBy());
|
||||
}
|
||||
synchronized (_failedTunnelParticipants) {
|
||||
_failedTunnelParticipants.add(_tunnel.getThisHop());
|
||||
|
Reference in New Issue
Block a user