* OCMOSJ, ElG, Streaming: log tweaks

This commit is contained in:
zzz
2012-06-21 19:10:14 +00:00
parent 39d9a25e19
commit baa89c5bbf
8 changed files with 45 additions and 48 deletions

View File

@ -83,7 +83,7 @@ public class GarlicMessage extends FastI2NPMessageImpl {
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("[GarlicMessage: ");
buf.append("\n\tData length: ").append(getData().length).append(" bytes");
buf.append("Data length: ").append(getData().length).append(" bytes");
buf.append("]");
return buf.toString();
}

View File

@ -233,8 +233,8 @@ public class GarlicMessageBuilder {
}
if (log.shouldLog(Log.DEBUG))
log.debug("CloveSet size for message " + msg.getUniqueId() + " is " + cloveSet.length
+ " and encrypted message data is " + encData.length);
log.debug("CloveSet (" + config.getCloveCount() + " cloves) for message " + msg.getUniqueId() + " is " + cloveSet.length
+ " bytes and encrypted message data is " + encData.length + " bytes");
return msg;
}
@ -268,7 +268,7 @@ public class GarlicMessageBuilder {
for (int i = 0; i < config.getCloveCount(); i++) {
GarlicConfig c = config.getClove(i);
if (c instanceof PayloadGarlicConfig) {
log.debug("Subclove IS a payload garlic clove");
//log.debug("Subclove IS a payload garlic clove");
cloves[i] = buildClove(ctx, (PayloadGarlicConfig)c);
} else {
log.debug("Subclove IS NOT a payload garlic clove");

View File

@ -71,13 +71,13 @@ class GarlicMessageParser {
if (_log.shouldLog(Log.DEBUG))
_log.debug("# cloves to read: " + numCloves);
for (int i = 0; i < numCloves; i++) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Reading clove " + i);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Reading clove " + i);
GarlicClove clove = new GarlicClove(_context);
offset += clove.readBytes(data, offset);
set.addClove(clove);
if (_log.shouldLog(Log.DEBUG))
_log.debug("After reading clove " + i);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("After reading clove " + i);
}
//Certificate cert = new Certificate();
//offset += cert.readBytes(data, offset);

View File

@ -88,7 +88,7 @@ class OutboundClientMessageJobHelper {
PayloadGarlicConfig dataClove, Hash from, Destination dest, TunnelInfo replyTunnel, boolean requireAck,
LeaseSet bundledReplyLeaseSet) {
Log log = ctx.logManager().getLog(OutboundClientMessageJobHelper.class);
if (log.shouldLog(Log.DEBUG))
if (replyToken >= 0 && log.shouldLog(Log.DEBUG))
log.debug("Reply token: " + replyToken);
GarlicConfig config = new GarlicConfig();
@ -136,20 +136,17 @@ class OutboundClientMessageJobHelper {
Log log = ctx.logManager().getLog(OutboundClientMessageJobHelper.class);
PayloadGarlicConfig ackClove = new PayloadGarlicConfig();
Hash replyToTunnelRouter = null; // inbound tunnel gateway
TunnelId replyToTunnelId = null; // tunnel id on that gateway
if (replyToTunnel == null) {
if (log.shouldLog(Log.WARN))
log.warn("Unable to send client message from " + from.toBase64()
+ ", as there are no inbound tunnels available");
return null;
}
replyToTunnelId = replyToTunnel.getReceiveTunnelId(0);
replyToTunnelRouter = replyToTunnel.getPeer(0);
TunnelId replyToTunnelId = replyToTunnel.getReceiveTunnelId(0); // tunnel id on that gateway
Hash replyToTunnelRouter = replyToTunnel.getPeer(0); // inbound tunnel gateway
if (log.shouldLog(Log.DEBUG))
log.debug("Ack for the data message will come back along tunnel " + replyToTunnelId
+ ":\n" + replyToTunnel);
+ ": " + replyToTunnel);
DeliveryInstructions ackInstructions = new DeliveryInstructions();
ackInstructions.setDeliveryMode(DeliveryInstructions.DELIVERY_MODE_TUNNEL);
@ -163,8 +160,8 @@ class OutboundClientMessageJobHelper {
DeliveryStatusMessage msg = new DeliveryStatusMessage(ctx);
msg.setArrival(ctx.clock().now());
msg.setMessageId(replyToken);
if (log.shouldLog(Log.DEBUG))
log.debug("Delivery status message key: " + replyToken + " arrival: " + msg.getArrival());
//if (log.shouldLog(Log.DEBUG))
// log.debug("Delivery status message key: " + replyToken + " arrival: " + msg.getArrival());
ackClove.setCertificate(Certificate.NULL_CERT);
ackClove.setDeliveryInstructions(ackInstructions);
@ -175,11 +172,11 @@ class OutboundClientMessageJobHelper {
// defaults
//ackClove.setRequestAck(false);
if (log.shouldLog(Log.DEBUG))
log.debug("Delivery status message is targetting us ["
+ ackClove.getRecipient().getIdentity().getHash().toBase64()
+ "] via tunnel " + replyToTunnelId.getTunnelId() + " on "
+ replyToTunnelRouter.toBase64());
//if (log.shouldLog(Log.DEBUG))
// log.debug("Delivery status message is targetting us ["
// + ackClove.getRecipient().getIdentity().getHash().toBase64()
// + "] via tunnel " + replyToTunnelId.getTunnelId() + " on "
// + replyToTunnelRouter.toBase64());
return ackClove;
}

View File

@ -150,8 +150,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
}
}
overallExpiration = timeoutMs + _start;
if (_log.shouldLog(Log.INFO))
_log.info(getJobId() + " Default Expiration (ms): " + timeoutMs);
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + " Default Expiration (ms): " + timeoutMs);
}
_overallExpiration = overallExpiration;
}
@ -182,9 +182,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
dieFatal();
return;
}
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Send outbound client message job beginning" +
": preparing to search for the leaseSet for " + _toString);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug(getJobId() + ": Send outbound client message job beginning" +
// ": preparing to search for the leaseSet for " + _toString);
long timeoutMs = _overallExpiration - now;
Hash key = _to.calculateHash();
SendJob success = new SendJob(getContext());
@ -474,8 +474,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
dieFatal();
return;
}
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Clove built to " + _toString);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug(getJobId() + ": Clove built to " + _toString);
long msgExpiration = _overallExpiration; // getContext().clock().now() + OVERALL_TIMEOUT_MS_DEFAULT;
GarlicMessage msg = OutboundClientMessageJobHelper.createGarlicMessage(getContext(), token,
msgExpiration, key,
@ -494,8 +494,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
return;
}
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": send() - token expected " + token + " to " + _toString);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug(getJobId() + ": send() - token expected " + token + " to " + _toString);
SendSuccessJob onReply = null;
SendTimeoutJob onFail = null;
@ -515,14 +515,14 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
}
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Placing GarlicMessage into the new tunnel message bound for "
_log.debug(getJobId() + ": GarlicMessage in new tunnel msg for "
+ _toString + " at "
+ _lease.getTunnelId() + " on "
+ _lease.getGateway());
if (_outTunnel != null) {
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Sending tunnel message out " + _outTunnel.getSendTunnelId(0) + " to "
_log.debug(getJobId() + ": Sending msg out " + _outTunnel.getSendTunnelId(0) + " to "
+ _toString + " at "
+ _lease.getTunnelId() + " on "
+ _lease.getGateway());
@ -571,9 +571,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
long before = getContext().clock().now();
getContext().tunnelDispatcher().dispatchOutbound(_msg, _outTunnel.getSendTunnelId(0), _lease.getTunnelId(), _lease.getGateway());
long dispatchSendTime = getContext().clock().now() - before;
if (_log.shouldLog(Log.INFO))
_log.info(OutboundClientMessageOneShotJob.this.getJobId() +
": Dispatching message to " + _toString + " complete");
//if (_log.shouldLog(Log.INFO))
// _log.info(OutboundClientMessageOneShotJob.this.getJobId() +
// ": Dispatching message to " + _toString + " complete");
getContext().statManager().addRateData("client.dispatchTime", getContext().clock().now() - _start, 0);
getContext().statManager().addRateData("client.dispatchSendTime", dispatchSendTime, 0);
}
@ -728,8 +728,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
_clove = clove;
_cloveId = _clove.getId();
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Built payload clove with id " + clove.getId());
//if (_log.shouldLog(Log.DEBUG))
// _log.debug(getJobId() + ": Built payload clove with id " + clove.getId());
return true;
}
@ -858,9 +858,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
public String getName() { return "Outbound client message send timeout"; }
public void runJob() {
if (_log.shouldLog(Log.INFO))
_log.info(OutboundClientMessageOneShotJob.this.getJobId()
+ ": Soft timeout through the lease " + _lease);
//if (_log.shouldLog(Log.INFO))
// _log.info(OutboundClientMessageOneShotJob.this.getJobId()
// + ": Soft timeout through the lease " + _lease);
// unused
//_lease.setNumFailure(_lease.getNumFailure()+1);