Applies logging improvements patch submitted by Jakub Adamek.

This commit is contained in:
paweldomas 2013-09-17 11:20:51 +00:00
parent e46ec4c494
commit f959ccfeb1
9 changed files with 57 additions and 23 deletions

View File

@ -1438,8 +1438,8 @@ public class Agent
//so it's now safe to go and see whether this is a new PR cand.
if(triggeredPair.getParentComponent().getSelectedPair() == null)
{
logger.info("Receive check from " +
triggeredPair.toShortString() + "triggered a check");
logger.info("Received check from " +
triggeredPair.toShortString() + " triggered a check");
}
triggerCheck(triggeredPair);
}
@ -1770,9 +1770,10 @@ public class Agent
{
CandidatePair selectedPair = component.getSelectedPair();
StringBuffer buf = new StringBuffer( "Harvester selected for ");
StringBuffer buf
= new StringBuffer( "Harvester used for selected pair for ");
buf.append(component.toShortString());
buf.append(" ");
buf.append(": ");
if(selectedPair == null)
{
@ -2364,7 +2365,7 @@ public class Agent
*
* @return The number of harvesting time for the harvester given in
* parameter.
*/
*/
public int getHarvestCount(String harvesterName)
{
int harvestCount;

View File

@ -742,6 +742,15 @@ public abstract class Candidate
return buff.toString();
}
/**
* Returns short <tt>String</tt> representation of this <tt>Candidate</tt>.
* @return short <tt>String</tt> representation of this <tt>Candidate</tt>.
*/
public String toShortString()
{
return getTransportAddress() + "/" + getType();
}
/**
* Returns an integer indicating the preference that this <tt>Candidate</tt>
* should be considered with for becoming a default candidate.

View File

@ -432,9 +432,9 @@ public class CandidatePair
*/
public String toShortString()
{
return getLocalCandidate().getTransportAddress() + " -> " +
getRemoteCandidate().getTransportAddress() +
" (" + getParentComponent().toShortString() + ")";
return getLocalCandidate().toShortString()
+ " -> " + getRemoteCandidate().toShortString()
+ " (" + getParentComponent().toShortString() + ")";
}
/**

View File

@ -248,8 +248,8 @@ public class Component
*/
public void addRemoteCandidate(RemoteCandidate candidate)
{
logger.info("Add remote candidate for " + toShortString() + ": " +
candidate.getTransportAddress());
logger.info("Add remote candidate for " + toShortString()
+ ": " + candidate.toShortString());
synchronized(remoteCandidates)
{

View File

@ -170,7 +170,6 @@ class ConnectivityCheckClient
//we don't need to do a canReach() verification here as it has been
//already verified during the gathering process.
logger.fine("start check for " + candidatePair.toShortString());
Request request = MessageFactory.createBindingRequest();
if(parentAgent.getCompatibilityMode() == CompatibilityMode.GTALK)
@ -264,6 +263,9 @@ class ConnectivityCheckClient
TransactionID tran = TransactionID.createNewTransactionID();
tran.setApplicationData(candidatePair);
logger.fine("start check for " + candidatePair.toShortString()
+ " tid " + tran);
try
{
TransportAddress localAddr = localCandidate.getBase().

View File

@ -269,12 +269,23 @@ public class StunCandidateHarvester
logger.finest(
"Completed " + component.toShortString() + " harvest: " + toString()
+ ". Found " + candidates.size() + " candidates.");
+ ". Found " + candidates.size()
+ " candidates: " + listCandidates(candidates));
return candidates;
}
private String listCandidates(Collection<? extends Candidate<?>> candidates)
{
StringBuilder retval = new StringBuilder();
for(Candidate<?> candidate : candidates)
{
retval.append(candidate.toShortString());
}
return retval.toString();
}
/**
* Sends a binding request to our stun server through the specified
* <tt>hostCand</tt> candidate and adds it to the list of addresses still

View File

@ -407,10 +407,10 @@ public class PseudoTCPBase
*/
public void notifyClock(long now)
{
if (logger.isLoggable(Level.FINEST))
/*if (logger.isLoggable(Level.FINEST))
{
logger.log(Level.FINEST, debugName + " update clock " + now);
}
}*/
if (m_state == PseudoTcpState.TCP_CLOSED)
{
return;
@ -1312,13 +1312,19 @@ public class PseudoTCPBase
{
if (seg.seq > m_rcv_nxt)
{
logger.log(Level.FINER, "too new");
logger.log(Level.FINER,
"too new, seq.seq=" + seg.seq
+ ", seg.len=" + seg.len
+ ", m_rcv_nxt=" + m_rcv_nxt);
}
else
{
if (seg.seq + seg.len <= m_rcv_nxt)
{
logger.log(Level.FINER, "too old");
logger.log(Level.FINER,
"too old, seq.seq=" + seg.seq
+ ", seg.len=" + seg.len
+ ", m_rcv_nxt=" + m_rcv_nxt);
}
}
}
@ -1748,7 +1754,7 @@ public class PseudoTCPBase
// in-flight data is acknowledged.
if (m_use_nagling && (m_snd_nxt > m_snd_una) && (nAvailable < m_mss))
{
logger.log(Level.FINER, "wait untill more data is acked");
logger.log(Level.FINER, "wait until more data is acked");
return;
}

View File

@ -230,8 +230,13 @@ class StunClientTransaction
try
{
logger.fine("retrying transmission of STUN test to " +
requestDestination.getHostAddress());
logger.fine("retrying transmission of STUN test"
+ " tid " + transactionID
+ " from " + localAddress
+ " to " + requestDestination
+ " nextWait " + nextWaitInterval
+ " retrans " + (retransmissionCounter+1)
+ " of " + maxRetransmissions);
sendRequest0();
}
catch (Exception ex)

View File

@ -760,10 +760,10 @@ public class StunStack
else
{
//do nothing - just drop the phantom response.
logger.fine("Dropped response - "
+ "no matching client tran found.");
logger.fine("response tid was - " + tid);
logger.fine("all tids in stock were" + clientTransactions);
logger.fine("Dropped response - no matching client tran found"
+ " for tid " + tid + "\n"
+ "all tids in stock were "
+ clientTransactions.keySet());
}
}
// indication