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. //so it's now safe to go and see whether this is a new PR cand.
if(triggeredPair.getParentComponent().getSelectedPair() == null) if(triggeredPair.getParentComponent().getSelectedPair() == null)
{ {
logger.info("Receive check from " + logger.info("Received check from " +
triggeredPair.toShortString() + "triggered a check"); triggeredPair.toShortString() + " triggered a check");
} }
triggerCheck(triggeredPair); triggerCheck(triggeredPair);
} }
@ -1770,9 +1770,10 @@ public class Agent
{ {
CandidatePair selectedPair = component.getSelectedPair(); 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(component.toShortString());
buf.append(" "); buf.append(": ");
if(selectedPair == null) if(selectedPair == null)
{ {

View File

@ -742,6 +742,15 @@ public abstract class Candidate
return buff.toString(); 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> * Returns an integer indicating the preference that this <tt>Candidate</tt>
* should be considered with for becoming a default candidate. * should be considered with for becoming a default candidate.

View File

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

View File

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

View File

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

View File

@ -269,12 +269,23 @@ public class StunCandidateHarvester
logger.finest( logger.finest(
"Completed " + component.toShortString() + " harvest: " + toString() "Completed " + component.toShortString() + " harvest: " + toString()
+ ". Found " + candidates.size() + " candidates."); + ". Found " + candidates.size()
+ " candidates: " + listCandidates(candidates));
return 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 * Sends a binding request to our stun server through the specified
* <tt>hostCand</tt> candidate and adds it to the list of addresses still * <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) public void notifyClock(long now)
{ {
if (logger.isLoggable(Level.FINEST)) /*if (logger.isLoggable(Level.FINEST))
{ {
logger.log(Level.FINEST, debugName + " update clock " + now); logger.log(Level.FINEST, debugName + " update clock " + now);
} }*/
if (m_state == PseudoTcpState.TCP_CLOSED) if (m_state == PseudoTcpState.TCP_CLOSED)
{ {
return; return;
@ -1312,13 +1312,19 @@ public class PseudoTCPBase
{ {
if (seg.seq > m_rcv_nxt) 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 else
{ {
if (seg.seq + seg.len <= m_rcv_nxt) 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. // in-flight data is acknowledged.
if (m_use_nagling && (m_snd_nxt > m_snd_una) && (nAvailable < m_mss)) 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; return;
} }

View File

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

View File

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