Skip to content

Commit 5e6952a

Browse files
committed
Merge pull request AsyncHttpClient#112 from slandelle/master
Clean up some logging
2 parents 333de99 + 7f95822 commit 5e6952a

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

src/main/java/com/ning/http/client/providers/apache/ApacheAsyncHttpProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ public boolean isDone() {
859859
*/
860860
public synchronized void run() {
861861
if (this.apacheResponseFuture != null && this.apacheResponseFuture.hasExpired()) {
862-
logger.debug("Request Timeout expired for " + this.apacheResponseFuture);
862+
logger.debug("Request Timeout expired for {}", this.apacheResponseFuture);
863863

864864
int requestTimeout = config.getRequestTimeoutInMs();
865865
PerRequestConfig p = this.apacheResponseFuture.getRequest().getPerRequestConfig();

src/main/java/com/ning/http/client/providers/grizzly/GrizzlyAsyncHttpProvider.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,7 @@ boolean sendRequest(final FilterChainContext ctx,
554554
} else {
555555
ctx.write(requestPacket, ctx.getTransportContext().getCompletionHandler());
556556
}
557-
if (LOGGER.isDebugEnabled()) {
558-
LOGGER.debug("REQUEST: " + requestPacket.toString());
559-
}
557+
LOGGER.debug("REQUEST: {}", requestPacket);
560558

561559
return isWriteComplete;
562560
}
@@ -1221,9 +1219,7 @@ protected void onHttpHeadersParsed(HttpHeader httpHeader,
12211219
FilterChainContext ctx) {
12221220

12231221
super.onHttpHeadersParsed(httpHeader, ctx);
1224-
if (LOGGER.isDebugEnabled()) {
1225-
LOGGER.debug("RESPONSE: " + httpHeader.toString());
1226-
}
1222+
LOGGER.debug("RESPONSE: {}", httpHeader);
12271223
if (httpHeader.containsHeader(Header.Connection)) {
12281224
if ("close".equals(httpHeader.getHeader(Header.Connection))) {
12291225
ConnectionManager.markConnectionAsDoNotCache(ctx.getConnection());

src/main/java/com/ning/http/client/providers/grizzly/GrizzlyConnectionsPool.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ public boolean offer(String uri, Connection connection) {
100100

101101
DelayedExecutor.IdleConnectionQueue conQueue = connectionsPool.get(uri);
102102
if (conQueue == null) {
103-
if (LOG.isDebugEnabled()) {
104-
LOG.debug("Creating new Connection queue for uri [{}] and connection [{}]",
105-
new Object[]{uri, connection});
106-
}
103+
LOG.debug("Creating new Connection queue for uri [{}] and connection [{}]",
104+
uri, connection);
107105
DelayedExecutor.IdleConnectionQueue newPool =
108106
delayedExecutor.createIdleConnectionQueue(timeout);
109107
conQueue = connectionsPool.putIfAbsent(uri, newPool);

src/main/java/com/ning/http/client/providers/netty/NettyConnectionsPool.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ public void run() {
126126
}
127127
}
128128

129-
log.trace(String.format("%d channel open, %d idle channels closed (times: 1st-loop=%d, 2nd-loop=%d).\n",
129+
if (log.isTraceEnabled())
130+
log.trace(String.format("%d channel open, %d idle channels closed (times: 1st-loop=%d, 2nd-loop=%d).\n",
130131
connectionsPool.size(), channelsInTimeout.size(), endConcurrentLoop - currentTime, System.currentTimeMillis() - endConcurrentLoop));
131132
} catch (Throwable t) {
132133
log.error("uncaught exception!", t);

0 commit comments

Comments
 (0)