Improved logging.

This commit is contained in:
Simone Bordet 2014-06-25 17:25:43 +02:00
parent bad3165d8a
commit 7b7c592fc8
3 changed files with 18 additions and 6 deletions

View File

@ -236,6 +236,11 @@ public class ConnectionPool implements Closeable, Dumpable
@Override
public String toString()
{
return String.format("%s %d/%d", getClass().getSimpleName(), connectionCount.get(), maxConnections);
return String.format("%s[c=%d/%d,a=%d,i=%d]",
getClass().getSimpleName(),
connectionCount.get(),
maxConnections,
activeConnections.size(),
idleConnections.size());
}
}

View File

@ -176,7 +176,7 @@ public abstract class HttpDestination implements Destination, Closeable, Dumpabl
else
{
if (LOG.isDebugEnabled())
LOG.debug("Queued {}", request);
LOG.debug("Queued {} for {}", request, this);
requestNotifier.notifyQueued(request);
send();
}
@ -184,7 +184,7 @@ public abstract class HttpDestination implements Destination, Closeable, Dumpabl
else
{
if (LOG.isDebugEnabled())
LOG.debug("Max queue size {} exceeded by {}", client.getMaxRequestsQueuedPerDestination(), request);
LOG.debug("Max queue size {} exceeded by {} for {}", client.getMaxRequestsQueuedPerDestination(), request, this);
request.abort(new RejectedExecutionException("Max requests per destination " + client.getMaxRequestsQueuedPerDestination() + " exceeded for " + this));
}
}
@ -258,9 +258,10 @@ public abstract class HttpDestination implements Destination, Closeable, Dumpabl
@Override
public String toString()
{
return String.format("%s(%s)%s",
return String.format("%s[%s]%s,queue=%d",
HttpDestination.class.getSimpleName(),
asString(),
proxy == null ? "" : " via " + proxy);
proxy == null ? "" : "(via " + proxy + ")",
exchanges.size());
}
}

View File

@ -94,7 +94,7 @@ public abstract class PoolingHttpDestination<C extends Connection> extends HttpD
HttpClient client = getHttpClient();
final HttpExchange exchange = getHttpExchanges().poll();
if (LOG.isDebugEnabled())
LOG.debug("Processing exchange {} on connection {}", exchange, connection);
LOG.debug("Processing exchange {} on {} of {}", exchange, connection, this);
if (exchange == null)
{
if (!connectionPool.release(connection))
@ -213,4 +213,10 @@ public abstract class PoolingHttpDestination<C extends Connection> extends HttpD
{
ContainerLifeCycle.dump(out, indent, Arrays.asList(connectionPool));
}
@Override
public String toString()
{
return String.format("%s,pool=%s", super.toString(), connectionPool);
}
}