HTTPCLIENT-2095: Use slf4j interpolation instead of string concatenation where possible (#232)

This commit is contained in:
Carter Kozak 2020-07-02 11:51:43 -04:00 committed by GitHub
parent 517e5c8d94
commit 84bd290954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 292 additions and 307 deletions

View File

@ -98,7 +98,7 @@ public String generateKey(final HttpHost host, final HttpRequest request, final
public Cancellable flushCacheEntriesFor( public Cancellable flushCacheEntriesFor(
final HttpHost host, final HttpRequest request, final FutureCallback<Boolean> callback) { final HttpHost host, final HttpRequest request, final FutureCallback<Boolean> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Flush cache entries: " + host + "; " + new RequestLine(request)); log.debug("Flush cache entries: {}; {}", host, new RequestLine(request));
} }
if (!Method.isSafe(request.getMethod())) { if (!Method.isSafe(request.getMethod())) {
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
@ -113,7 +113,7 @@ public void completed(final Boolean result) {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error removing cache entry with key " + cacheKey); log.warn("I/O error removing cache entry with key {}", cacheKey);
} }
callback.completed(Boolean.TRUE); callback.completed(Boolean.TRUE);
} else { } else {
@ -136,7 +136,7 @@ public void cancelled() {
public Cancellable flushCacheEntriesInvalidatedByRequest( public Cancellable flushCacheEntriesInvalidatedByRequest(
final HttpHost host, final HttpRequest request, final FutureCallback<Boolean> callback) { final HttpHost host, final HttpRequest request, final FutureCallback<Boolean> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by request: " + host + "; " + new RequestLine(request)); log.debug("Flush cache entries invalidated by request: {}; {}", host, new RequestLine(request));
} }
return cacheInvalidator.flushCacheEntriesInvalidatedByRequest(host, request, cacheKeyGenerator, storage, callback); return cacheInvalidator.flushCacheEntriesInvalidatedByRequest(host, request, cacheKeyGenerator, storage, callback);
} }
@ -145,7 +145,7 @@ public Cancellable flushCacheEntriesInvalidatedByRequest(
public Cancellable flushCacheEntriesInvalidatedByExchange( public Cancellable flushCacheEntriesInvalidatedByExchange(
final HttpHost host, final HttpRequest request, final HttpResponse response, final FutureCallback<Boolean> callback) { final HttpHost host, final HttpRequest request, final HttpResponse response, final FutureCallback<Boolean> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by exchange: " + host + "; " + new RequestLine(request) + " -> " + new StatusLine(response)); log.debug("Flush cache entries invalidated by exchange: {}; {} -> {}", host, new RequestLine(request), new StatusLine(response));
} }
if (!Method.isSafe(request.getMethod())) { if (!Method.isSafe(request.getMethod())) {
return cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage, callback); return cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage, callback);
@ -182,7 +182,7 @@ public void completed(final Boolean result) {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error storing cache entry with key " + cacheKey); log.warn("I/O error storing cache entry with key {}", cacheKey);
} }
callback.completed(Boolean.TRUE); callback.completed(Boolean.TRUE);
} else { } else {
@ -230,11 +230,11 @@ public void completed(final Boolean result) {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof HttpCacheUpdateException) { if (ex instanceof HttpCacheUpdateException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Cannot update cache entry with key " + cacheKey); log.warn("Cannot update cache entry with key {}", cacheKey);
} }
} else if (ex instanceof ResourceIOException) { } else if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
} else { } else {
callback.failed(ex); callback.failed(ex);
@ -253,7 +253,7 @@ public void cancelled() {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + variantCacheKey); log.warn("I/O error updating cache entry with key {}", variantCacheKey);
} }
callback.completed(Boolean.TRUE); callback.completed(Boolean.TRUE);
} else { } else {
@ -273,7 +273,7 @@ public void cancelled() {
public Cancellable reuseVariantEntryFor( public Cancellable reuseVariantEntryFor(
final HttpHost host, final HttpRequest request, final Variant variant, final FutureCallback<Boolean> callback) { final HttpHost host, final HttpRequest request, final Variant variant, final FutureCallback<Boolean> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Re-use variant entry: " + host + "; " + new RequestLine(request) + " / " + variant); log.debug("Re-use variant entry: {}; {} / {}", host, new RequestLine(request), variant);
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
final HttpCacheEntry entry = variant.getEntry(); final HttpCacheEntry entry = variant.getEntry();
@ -299,11 +299,11 @@ public void completed(final Boolean result) {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof HttpCacheUpdateException) { if (ex instanceof HttpCacheUpdateException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Cannot update cache entry with key " + cacheKey); log.warn("Cannot update cache entry with key {}", cacheKey);
} }
} else if (ex instanceof ResourceIOException) { } else if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
} else { } else {
callback.failed(ex); callback.failed(ex);
@ -328,7 +328,7 @@ public Cancellable updateCacheEntry(
final Date responseReceived, final Date responseReceived,
final FutureCallback<HttpCacheEntry> callback) { final FutureCallback<HttpCacheEntry> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Update cache entry: " + host + "; " + new RequestLine(request)); log.debug("Update cache entry: {}; {}", host, new RequestLine(request));
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
try { try {
@ -358,7 +358,7 @@ public void cancelled() {
}); });
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
callback.completed(stale); callback.completed(stale);
return Operations.nonCancellable(); return Operations.nonCancellable();
@ -375,7 +375,7 @@ public Cancellable updateVariantCacheEntry(
final Date responseReceived, final Date responseReceived,
final FutureCallback<HttpCacheEntry> callback) { final FutureCallback<HttpCacheEntry> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Update variant cache entry: " + host + "; " + new RequestLine(request) + " / " + variant); log.debug("Update variant cache entry: {}; {} / {}", host, new RequestLine(request), variant);
} }
final HttpCacheEntry entry = variant.getEntry(); final HttpCacheEntry entry = variant.getEntry();
final String cacheKey = variant.getCacheKey(); final String cacheKey = variant.getCacheKey();
@ -406,7 +406,7 @@ public void cancelled() {
}); });
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
callback.completed(entry); callback.completed(entry);
return Operations.nonCancellable(); return Operations.nonCancellable();
@ -423,7 +423,7 @@ public Cancellable createCacheEntry(
final Date responseReceived, final Date responseReceived,
final FutureCallback<HttpCacheEntry> callback) { final FutureCallback<HttpCacheEntry> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Create cache entry: " + host + "; " + new RequestLine(request)); log.debug("Create cache entry: {}; {}", host, new RequestLine(request));
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
try { try {
@ -448,7 +448,7 @@ public void cancelled() {
}); });
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error creating cache entry with key " + cacheKey); log.warn("I/O error creating cache entry with key {}", cacheKey);
} }
callback.completed(new HttpCacheEntry( callback.completed(new HttpCacheEntry(
requestSent, requestSent,
@ -463,7 +463,7 @@ public void cancelled() {
@Override @Override
public Cancellable getCacheEntry(final HttpHost host, final HttpRequest request, final FutureCallback<HttpCacheEntry> callback) { public Cancellable getCacheEntry(final HttpHost host, final HttpRequest request, final FutureCallback<HttpCacheEntry> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get cache entry: " + host + "; " + new RequestLine(request)); log.debug("Get cache entry: {}; {}", host, new RequestLine(request));
} }
final ComplexCancellable complexCancellable = new ComplexCancellable(); final ComplexCancellable complexCancellable = new ComplexCancellable();
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
@ -489,7 +489,7 @@ public void completed(final HttpCacheEntry result) {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + variantCacheKey); log.warn("I/O error retrieving cache entry with key {}", variantCacheKey);
} }
callback.completed(null); callback.completed(null);
} else { } else {
@ -514,7 +514,7 @@ public void cancelled() {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + cacheKey); log.warn("I/O error retrieving cache entry with key {}", cacheKey);
} }
callback.completed(null); callback.completed(null);
} else { } else {
@ -535,7 +535,7 @@ public void cancelled() {
public Cancellable getVariantCacheEntriesWithEtags( public Cancellable getVariantCacheEntriesWithEtags(
final HttpHost host, final HttpRequest request, final FutureCallback<Map<String, Variant>> callback) { final HttpHost host, final HttpRequest request, final FutureCallback<Map<String, Variant>> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get variant cache entries: " + host + "; " + new RequestLine(request)); log.debug("Get variant cache entries: {}; {}", host, new RequestLine(request));
} }
final ComplexCancellable complexCancellable = new ComplexCancellable(); final ComplexCancellable complexCancellable = new ComplexCancellable();
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
@ -567,7 +567,7 @@ public void completed(final Map<String, HttpCacheEntry> resultMap) {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with keys " + variantCacheKeys); log.warn("I/O error retrieving cache entry with keys {}", variantCacheKeys);
} }
callback.completed(variants); callback.completed(variants);
} else { } else {
@ -590,7 +590,7 @@ public void cancelled() {
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (ex instanceof ResourceIOException) { if (ex instanceof ResourceIOException) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + cacheKey); log.warn("I/O error retrieving cache entry with key {}", cacheKey);
} }
callback.completed(variants); callback.completed(variants);
} else { } else {

View File

@ -100,7 +100,7 @@ public String generateKey(final HttpHost host, final HttpRequest request, final
@Override @Override
public void flushCacheEntriesFor(final HttpHost host, final HttpRequest request) { public void flushCacheEntriesFor(final HttpHost host, final HttpRequest request) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Flush cache entries: " + host + "; " + new RequestLine(request)); log.debug("Flush cache entries: {}; {}", host, new RequestLine(request));
} }
if (!Method.isSafe(request.getMethod())) { if (!Method.isSafe(request.getMethod())) {
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
@ -108,7 +108,7 @@ public void flushCacheEntriesFor(final HttpHost host, final HttpRequest request)
storage.removeEntry(cacheKey); storage.removeEntry(cacheKey);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error removing cache entry with key " + cacheKey); log.warn("I/O error removing cache entry with key {}", cacheKey);
} }
} }
} }
@ -117,7 +117,7 @@ public void flushCacheEntriesFor(final HttpHost host, final HttpRequest request)
@Override @Override
public void flushCacheEntriesInvalidatedByRequest(final HttpHost host, final HttpRequest request) { public void flushCacheEntriesInvalidatedByRequest(final HttpHost host, final HttpRequest request) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by request: " + host + "; " + new RequestLine(request)); log.debug("Flush cache entries invalidated by request: {}; {}", host, new RequestLine(request));
} }
cacheInvalidator.flushCacheEntriesInvalidatedByRequest(host, request, cacheKeyGenerator, storage); cacheInvalidator.flushCacheEntriesInvalidatedByRequest(host, request, cacheKeyGenerator, storage);
} }
@ -125,7 +125,7 @@ public void flushCacheEntriesInvalidatedByRequest(final HttpHost host, final Htt
@Override @Override
public void flushCacheEntriesInvalidatedByExchange(final HttpHost host, final HttpRequest request, final HttpResponse response) { public void flushCacheEntriesInvalidatedByExchange(final HttpHost host, final HttpRequest request, final HttpResponse response) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by exchange: " + host + "; " + new RequestLine(request) + " -> " + new StatusLine(response)); log.debug("Flush cache entries invalidated by exchange: {}; {} -> {}", host, new RequestLine(request), new StatusLine(response));
} }
if (!Method.isSafe(request.getMethod())) { if (!Method.isSafe(request.getMethod())) {
cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage); cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage);
@ -149,7 +149,7 @@ void storeEntry(final String cacheKey, final HttpCacheEntry entry) {
storage.putEntry(cacheKey, entry); storage.putEntry(cacheKey, entry);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error storing cache entry with key " + cacheKey); log.warn("I/O error storing cache entry with key {}", cacheKey);
} }
} }
} }
@ -173,11 +173,11 @@ public HttpCacheEntry execute(final HttpCacheEntry existing) throws ResourceIOEx
}); });
} catch (final HttpCacheUpdateException ex) { } catch (final HttpCacheUpdateException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Cannot update cache entry with key " + cacheKey); log.warn("Cannot update cache entry with key {}", cacheKey);
} }
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
} }
} }
@ -186,7 +186,7 @@ public HttpCacheEntry execute(final HttpCacheEntry existing) throws ResourceIOEx
public void reuseVariantEntryFor( public void reuseVariantEntryFor(
final HttpHost host, final HttpRequest request, final Variant variant) { final HttpHost host, final HttpRequest request, final Variant variant) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Re-use variant entry: " + host + "; " + new RequestLine(request) + " / " + variant); log.debug("Re-use variant entry: {}; {} / {}", host, new RequestLine(request), variant);
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
final HttpCacheEntry entry = variant.getEntry(); final HttpCacheEntry entry = variant.getEntry();
@ -204,11 +204,11 @@ public HttpCacheEntry execute(final HttpCacheEntry existing) throws ResourceIOEx
}); });
} catch (final HttpCacheUpdateException ex) { } catch (final HttpCacheUpdateException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Cannot update cache entry with key " + cacheKey); log.warn("Cannot update cache entry with key {}", cacheKey);
} }
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
} }
} }
@ -222,7 +222,7 @@ public HttpCacheEntry updateCacheEntry(
final Date requestSent, final Date requestSent,
final Date responseReceived) { final Date responseReceived) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Update cache entry: " + host + "; " + new RequestLine(request)); log.debug("Update cache entry: {}; {}", host, new RequestLine(request));
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
try { try {
@ -236,7 +236,7 @@ public HttpCacheEntry updateCacheEntry(
return updatedEntry; return updatedEntry;
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
return stale; return stale;
} }
@ -251,7 +251,7 @@ public HttpCacheEntry updateVariantCacheEntry(
final Date requestSent, final Date requestSent,
final Date responseReceived) { final Date responseReceived) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Update variant cache entry: " + host + "; " + new RequestLine(request) + " / " + variant); log.debug("Update variant cache entry: {}; {} / {}", host, new RequestLine(request), variant);
} }
final HttpCacheEntry entry = variant.getEntry(); final HttpCacheEntry entry = variant.getEntry();
final String cacheKey = variant.getCacheKey(); final String cacheKey = variant.getCacheKey();
@ -266,7 +266,7 @@ public HttpCacheEntry updateVariantCacheEntry(
return updatedEntry; return updatedEntry;
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error updating cache entry with key " + cacheKey); log.warn("I/O error updating cache entry with key {}", cacheKey);
} }
return entry; return entry;
} }
@ -281,7 +281,7 @@ public HttpCacheEntry createCacheEntry(
final Date requestSent, final Date requestSent,
final Date responseReceived) { final Date responseReceived) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Create cache entry: " + host + "; " + new RequestLine(request)); log.debug("Create cache entry: {}; {}", host, new RequestLine(request));
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
try { try {
@ -290,7 +290,7 @@ public HttpCacheEntry createCacheEntry(
return entry; return entry;
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error creating cache entry with key " + cacheKey); log.warn("I/O error creating cache entry with key {}", cacheKey);
} }
return new HttpCacheEntry( return new HttpCacheEntry(
requestSent, requestSent,
@ -304,7 +304,7 @@ public HttpCacheEntry createCacheEntry(
@Override @Override
public HttpCacheEntry getCacheEntry(final HttpHost host, final HttpRequest request) { public HttpCacheEntry getCacheEntry(final HttpHost host, final HttpRequest request) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get cache entry: " + host + "; " + new RequestLine(request)); log.debug("Get cache entry: {}; {}", host, new RequestLine(request));
} }
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
final HttpCacheEntry root; final HttpCacheEntry root;
@ -312,7 +312,7 @@ public HttpCacheEntry getCacheEntry(final HttpHost host, final HttpRequest reque
root = storage.getEntry(cacheKey); root = storage.getEntry(cacheKey);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + cacheKey); log.warn("I/O error retrieving cache entry with key {}", cacheKey);
} }
return null; return null;
} }
@ -331,7 +331,7 @@ public HttpCacheEntry getCacheEntry(final HttpHost host, final HttpRequest reque
return storage.getEntry(variantCacheKey); return storage.getEntry(variantCacheKey);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + variantCacheKey); log.warn("I/O error retrieving cache entry with key {}", variantCacheKey);
} }
return null; return null;
} }
@ -340,7 +340,7 @@ public HttpCacheEntry getCacheEntry(final HttpHost host, final HttpRequest reque
@Override @Override
public Map<String, Variant> getVariantCacheEntriesWithEtags(final HttpHost host, final HttpRequest request) { public Map<String, Variant> getVariantCacheEntriesWithEtags(final HttpHost host, final HttpRequest request) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get variant cache entries: " + host + "; " + new RequestLine(request)); log.debug("Get variant cache entries: {}; {}", host, new RequestLine(request));
} }
final Map<String,Variant> variants = new HashMap<>(); final Map<String,Variant> variants = new HashMap<>();
final String cacheKey = cacheKeyGenerator.generateKey(host, request); final String cacheKey = cacheKeyGenerator.generateKey(host, request);
@ -349,7 +349,7 @@ public Map<String, Variant> getVariantCacheEntriesWithEtags(final HttpHost host,
root = storage.getEntry(cacheKey); root = storage.getEntry(cacheKey);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + cacheKey); log.warn("I/O error retrieving cache entry with key {}", cacheKey);
} }
return variants; return variants;
} }
@ -366,7 +366,7 @@ public Map<String, Variant> getVariantCacheEntriesWithEtags(final HttpHost host,
} }
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("I/O error retrieving cache entry with key " + variantCacheKey); log.warn("I/O error retrieving cache entry with key {}", variantCacheKey);
} }
return variants; return variants;
} }

View File

@ -131,7 +131,7 @@ void scheduleRevalidation(final String cacheKey, final Runnable command) {
scheduledExecutor.schedule(command, executionTime); scheduledExecutor.schedule(command, executionTime);
pendingRequest.add(cacheKey); pendingRequest.add(cacheKey);
} catch (final RejectedExecutionException ex) { } catch (final RejectedExecutionException ex) {
log.debug("Revalidation of cache entry with key " + cacheKey + "could not be scheduled: " + ex); log.debug("Revalidation of cache entry with key {} could not be scheduled", cacheKey, ex);
} }
} }
} }

View File

@ -62,7 +62,7 @@ public boolean isServableFromCache(final HttpRequest request) {
if (!method.equals(HeaderConstants.GET_METHOD) && !method.equals(HeaderConstants.HEAD_METHOD)) { if (!method.equals(HeaderConstants.GET_METHOD) && !method.equals(HeaderConstants.HEAD_METHOD)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(method + " request is not serveable from cache"); log.debug("{} request is not serveable from cache", method);
} }
return false; return false;
} }

View File

@ -195,7 +195,7 @@ public boolean canCachedResponseBeUsed(final HttpHost host, final HttpRequest re
} }
} catch (final NumberFormatException ex) { } catch (final NumberFormatException ex) {
// err conservatively // err conservatively
log.debug("Response from cache was malformed" + ex.getMessage()); log.debug("Response from cache was malformed: {}", ex.getMessage());
return false; return false;
} }
} }
@ -210,7 +210,7 @@ public boolean canCachedResponseBeUsed(final HttpHost host, final HttpRequest re
} }
} catch (final NumberFormatException ex) { } catch (final NumberFormatException ex) {
// err conservatively // err conservatively
log.debug("Response from cache was malformed: " + ex.getMessage()); log.debug("Response from cache was malformed: {}", ex.getMessage());
return false; return false;
} }
} }
@ -231,7 +231,7 @@ public boolean canCachedResponseBeUsed(final HttpHost host, final HttpRequest re
} }
} catch (final NumberFormatException ex) { } catch (final NumberFormatException ex) {
// err conservatively // err conservatively
log.debug("Response from cache was malformed: " + ex.getMessage()); log.debug("Response from cache was malformed: {}", ex.getMessage());
return false; return false;
} }
} }

View File

@ -153,22 +153,22 @@ SimpleHttpResponse getFatallyNoncompliantResponse(
void recordCacheMiss(final HttpHost target, final HttpRequest request) { void recordCacheMiss(final HttpHost target, final HttpRequest request) {
cacheMisses.getAndIncrement(); cacheMisses.getAndIncrement();
if (log.isTraceEnabled()) { if (log.isDebugEnabled()) {
log.debug("Cache miss [host: " + target + "; uri: " + request.getRequestUri() + "]"); log.debug("Cache miss [host: {}; uri: {}]", target, request.getRequestUri());
} }
} }
void recordCacheHit(final HttpHost target, final HttpRequest request) { void recordCacheHit(final HttpHost target, final HttpRequest request) {
cacheHits.getAndIncrement(); cacheHits.getAndIncrement();
if (log.isTraceEnabled()) { if (log.isDebugEnabled()) {
log.debug("Cache hit [host: " + target + "; uri: " + request.getRequestUri() + "]"); log.debug("Cache hit [host: {}; uri: {}]", target, request.getRequestUri());
} }
} }
void recordCacheFailure(final HttpHost target, final HttpRequest request) { void recordCacheFailure(final HttpHost target, final HttpRequest request) {
cacheMisses.getAndIncrement(); cacheMisses.getAndIncrement();
if (log.isTraceEnabled()) { if (log.isDebugEnabled()) {
log.debug("Cache failure [host: " + target + "; uri: " + request.getRequestUri() + "]"); log.debug("Cache failure [host: {}; uri: {}]", target, request.getRequestUri());
} }
} }

View File

@ -71,9 +71,9 @@ private void removeEntry(final HttpAsyncCacheStorage storage, final String cache
public void completed(final Boolean result) { public void completed(final Boolean result) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
if (result) { if (result) {
log.debug("Cache entry with key " + cacheKey + " successfully flushed"); log.debug("Cache entry with key {} successfully flushed", cacheKey);
} else { } else {
log.debug("Cache entry with key " + cacheKey + " could not be flushed"); log.debug("Cache entry with key {} could not be flushed", cacheKey);
} }
} }
} }
@ -81,7 +81,7 @@ public void completed(final Boolean result) {
@Override @Override
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Unable to flush cache entry with key " + cacheKey, ex); log.warn("Unable to flush cache entry with key {}", cacheKey, ex);
} }
} }
@ -109,7 +109,7 @@ public void completed(final HttpCacheEntry parentEntry) {
if (requestShouldNotBeCached(request) || shouldInvalidateHeadCacheEntry(request, parentEntry)) { if (requestShouldNotBeCached(request) || shouldInvalidateHeadCacheEntry(request, parentEntry)) {
if (parentEntry != null) { if (parentEntry != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invalidating parentEntry cache entry with key " + cacheKey); log.debug("Invalidating parentEntry cache entry with key {}", cacheKey);
} }
for (final String variantURI : parentEntry.getVariantMap().values()) { for (final String variantURI : parentEntry.getVariantMap().values()) {
removeEntry(storage, variantURI); removeEntry(storage, variantURI);
@ -118,7 +118,7 @@ public void completed(final HttpCacheEntry parentEntry) {
} }
if (uri != null) { if (uri != null) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn(s + " is not a valid URI"); log.warn("{} is not a valid URI", s);
} }
final Header clHdr = request.getFirstHeader("Content-Location"); final Header clHdr = request.getFirstHeader("Content-Location");
if (clHdr != null) { if (clHdr != null) {

View File

@ -63,7 +63,7 @@ private HttpCacheEntry getEntry(final HttpCacheStorage storage, final String cac
return storage.getEntry(cacheKey); return storage.getEntry(cacheKey);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Unable to get cache entry with key " + cacheKey, ex); log.warn("Unable to get cache entry with key {}", cacheKey, ex);
} }
return null; return null;
} }
@ -74,7 +74,7 @@ private void removeEntry(final HttpCacheStorage storage, final String cacheKey)
storage.removeEntry(cacheKey); storage.removeEntry(cacheKey);
} catch (final ResourceIOException ex) { } catch (final ResourceIOException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Unable to flush cache entry with key " + cacheKey, ex); log.warn("Unable to flush cache entry with key {}", cacheKey, ex);
} }
} }
} }
@ -93,7 +93,7 @@ public void flushCacheEntriesInvalidatedByRequest(
if (requestShouldNotBeCached(request) || shouldInvalidateHeadCacheEntry(request, parent)) { if (requestShouldNotBeCached(request) || shouldInvalidateHeadCacheEntry(request, parent)) {
if (parent != null) { if (parent != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invalidating parent cache entry with key " + cacheKey); log.debug("Invalidating parent cache entry with key {}", cacheKey);
} }
for (final String variantURI : parent.getVariantMap().values()) { for (final String variantURI : parent.getVariantMap().values()) {
removeEntry(storage, variantURI); removeEntry(storage, variantURI);
@ -102,7 +102,7 @@ public void flushCacheEntriesInvalidatedByRequest(
} }
if (uri != null) { if (uri != null) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn(s + " is not a valid URI"); log.warn("{} is not a valid URI", s);
} }
final Header clHdr = request.getFirstHeader("Content-Location"); final Header clHdr = request.getFirstHeader("Content-Location");
if (clHdr != null) { if (clHdr != null) {

View File

@ -129,7 +129,7 @@ private String buildHeaderFromElements(final List<HeaderElement> outElts) {
} else { } else {
first = false; first = false;
} }
newHdr.append(elt.toString()); newHdr.append(elt);
} }
return newHdr.toString(); return newHdr.toString();
} }

View File

@ -104,7 +104,7 @@ public boolean isResponseCacheable(final String httpMethod, final HttpResponse r
if (!HeaderConstants.GET_METHOD.equals(httpMethod) && !HeaderConstants.HEAD_METHOD.equals(httpMethod)) { if (!HeaderConstants.GET_METHOD.equals(httpMethod) && !HeaderConstants.HEAD_METHOD.equals(httpMethod)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(httpMethod + " method response is not cacheable"); log.debug("{} method response is not cacheable", httpMethod);
} }
return false; return false;
} }
@ -115,14 +115,14 @@ public boolean isResponseCacheable(final String httpMethod, final HttpResponse r
cacheable = true; cacheable = true;
} else if (uncacheableStatusCodes.contains(status)) { } else if (uncacheableStatusCodes.contains(status)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(status + " response is not cacheable"); log.debug("{} response is not cacheable", status);
} }
return false; return false;
} else if (unknownStatusCode(status)) { } else if (unknownStatusCode(status)) {
// a response with an unknown status code MUST NOT be // a response with an unknown status code MUST NOT be
// cached // cached
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(status + " response is unknown"); log.debug("{} response is unknown", status);
} }
return false; return false;
} }
@ -132,7 +132,7 @@ public boolean isResponseCacheable(final String httpMethod, final HttpResponse r
final long contentLengthValue = Long.parseLong(contentLength.getValue()); final long contentLengthValue = Long.parseLong(contentLength.getValue());
if (contentLengthValue > this.maxObjectSizeBytes) { if (contentLengthValue > this.maxObjectSizeBytes) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Response content length exceeds " + this.maxObjectSizeBytes); log.debug("Response content length exceeds {}", this.maxObjectSizeBytes);
} }
return false; return false;
} }
@ -247,7 +247,7 @@ public boolean isResponseCacheable(final HttpRequest request, final HttpResponse
final ProtocolVersion version = request.getVersion() != null ? request.getVersion() : HttpVersion.DEFAULT; final ProtocolVersion version = request.getVersion() != null ? request.getVersion() : HttpVersion.DEFAULT;
if (version.compareToVersion(HttpVersion.HTTP_1_1) > 0) { if (version.compareToVersion(HttpVersion.HTTP_1_1) > 0) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Protocol version " + version + " is non-cacheable"); log.debug("Protocol version {} is non-cacheable", version);
} }
return false; return false;
} }

View File

@ -133,7 +133,7 @@ private void identityIsNotUsedInContentEncoding(final HttpResponse response) {
if (!first) { if (!first) {
buf.append(","); buf.append(",");
} }
buf.append(elt.toString()); buf.append(elt);
first = false; first = false;
} }
} }

View File

@ -122,7 +122,7 @@ private void logResult(final TestResult result, final HttpRequest request, final
if (message != null && !TextUtils.isBlank(message)) { if (message != null && !TextUtils.isBlank(message)) {
buf.append(" -> ").append(message); buf.append(" -> ").append(message);
} }
System.out.println(buf.toString()); System.out.println(buf);
} }
void execute() throws Exception { void execute() throws Exception {

View File

@ -109,7 +109,7 @@ private void logResult(final TestResult result, final HttpRequest request, final
if (message != null && !TextUtils.isBlank(message)) { if (message != null && !TextUtils.isBlank(message)) {
buf.append(" -> ").append(message); buf.append(" -> ").append(message);
} }
System.out.println(buf.toString()); System.out.println(buf);
} }
void execute() { void execute() {

View File

@ -157,7 +157,7 @@ private void logResult(final TestResult result, final HttpRequest request, final
if (message != null && !TextUtils.isBlank(message)) { if (message != null && !TextUtils.isBlank(message)) {
buf.append(" -> ").append(message); buf.append(" -> ").append(message);
} }
System.out.println(buf.toString()); System.out.println(buf);
} }
void execute() throws Exception { void execute() throws Exception {

View File

@ -133,7 +133,7 @@ private void logResult(final TestResult result, final HttpRequest request, final
if (message != null && !TextUtils.isBlank(message)) { if (message != null && !TextUtils.isBlank(message)) {
buf.append(" -> ").append(message); buf.append(" -> ").append(message);
} }
System.out.println(buf.toString()); System.out.println(buf);
} }
void execute() { void execute() {

View File

@ -92,7 +92,7 @@ public class WindowsNegotiateScheme implements AuthScheme {
this.servicePrincipalName = servicePrincipalName; this.servicePrincipalName = servicePrincipalName;
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Created WindowsNegotiateScheme using " + this.schemeName); this.log.debug("Created WindowsNegotiateScheme using {}", this.schemeName);
} }
} }
@ -258,7 +258,7 @@ private String getServicePrincipalName(final HttpRequest request, final HttpClie
} }
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Using SPN: " + spn); this.log.debug("Using SPN: {}", spn);
} }
return spn; return spn;
} }

View File

@ -94,7 +94,7 @@ public List<AuthScheme> select(
authPrefs = DEFAULT_SCHEME_PRIORITY; authPrefs = DEFAULT_SCHEME_PRIORITY;
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Authentication schemes in the order of preference: " + authPrefs); this.log.debug("Authentication schemes in the order of preference: {}", authPrefs);
} }
for (final String schemeName: authPrefs) { for (final String schemeName: authPrefs) {
@ -103,7 +103,7 @@ public List<AuthScheme> select(
final AuthSchemeFactory authSchemeFactory = registry.lookup(schemeName); final AuthSchemeFactory authSchemeFactory = registry.lookup(schemeName);
if (authSchemeFactory == null) { if (authSchemeFactory == null) {
if (this.log.isWarnEnabled()) { if (this.log.isWarnEnabled()) {
this.log.warn("Authentication scheme " + schemeName + " not supported"); this.log.warn("Authentication scheme {} not supported", schemeName);
// Try again // Try again
} }
continue; continue;
@ -112,7 +112,7 @@ public List<AuthScheme> select(
options.add(authScheme); options.add(authScheme);
} else { } else {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Challenge for " + schemeName + " authentication scheme not available"); this.log.debug("Challenge for {} authentication scheme not available", schemeName);
} }
} }
} }

View File

@ -87,7 +87,7 @@ public void add(final String host, final InetAddress... ips) {
public InetAddress[] resolve(final String host) throws UnknownHostException { public InetAddress[] resolve(final String host) throws UnknownHostException {
final InetAddress[] resolvedAddresses = dnsMap.get(host); final InetAddress[] resolvedAddresses = dnsMap.get(host);
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("Resolving " + host + " to " + Arrays.deepToString(resolvedAddresses)); log.info("Resolving {} to {}", host, Arrays.deepToString(resolvedAddresses));
} }
if(resolvedAddresses == null){ if(resolvedAddresses == null){
throw new UnknownHostException(host + " cannot be resolved"); throw new UnknownHostException(host + " cannot be resolved");

View File

@ -86,11 +86,11 @@ private void wire(final String header, final byte[] b, final int pos, final int
if (ch == 13) { if (ch == 13) {
buffer.append("[\\r]"); buffer.append("[\\r]");
} else if (ch == 10) { } else if (ch == 10) {
buffer.append("[\\n]\""); buffer.append("[\\n]\"");
buffer.insert(0, "\""); buffer.insert(0, "\"");
buffer.insert(0, header); buffer.insert(0, header);
this.log.debug(this.id + " " + buffer.toString()); this.log.debug("{} {}", this.id, buffer);
buffer.setLength(0); buffer.setLength(0);
} else if ((ch < 32) || (ch >= 127)) { } else if ((ch < 32) || (ch >= 127)) {
buffer.append("[0x"); buffer.append("[0x");
buffer.append(Integer.toHexString(ch)); buffer.append(Integer.toHexString(ch));
@ -103,7 +103,7 @@ private void wire(final String header, final byte[] b, final int pos, final int
buffer.append('\"'); buffer.append('\"');
buffer.insert(0, '\"'); buffer.insert(0, '\"');
buffer.insert(0, header); buffer.insert(0, header);
this.log.debug(this.id + " " + buffer.toString()); this.log.debug("{} {}", this.id, buffer);
} }
} }

View File

@ -113,7 +113,7 @@ void internalClose(final CloseMode closeMode) {
@Override @Override
public final void close(final CloseMode closeMode) { public final void close(final CloseMode closeMode) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Shutdown " + closeMode); log.debug("Shutdown {}", closeMode);
} }
ioReactor.initiateShutdown(); ioReactor.initiateShutdown();
ioReactor.close(closeMode); ioReactor.close(closeMode);

View File

@ -129,7 +129,7 @@ public void execute(
if (!execRuntime.isEndpointAcquired()) { if (!execRuntime.isEndpointAcquired()) {
final Object userToken = clientContext.getUserToken(); final Object userToken = clientContext.getUserToken();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": acquiring connection with route " + route); log.debug("{}: acquiring connection with route {}", exchangeId, route);
} }
cancellableDependency.setDependency(execRuntime.acquireEndpoint( cancellableDependency.setDependency(execRuntime.acquireEndpoint(
exchangeId, route, userToken, clientContext, new FutureCallback<AsyncExecRuntime>() { exchangeId, route, userToken, clientContext, new FutureCallback<AsyncExecRuntime>() {
@ -198,7 +198,7 @@ private void proceedToNextHop(
public void completed(final AsyncExecRuntime execRuntime) { public void completed(final AsyncExecRuntime execRuntime) {
tracker.connectTarget(route.isSecure()); tracker.connectTarget(route.isSecure());
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": connected to target"); log.debug("{}: connected to target", exchangeId);
} }
proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback); proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback);
} }
@ -224,7 +224,7 @@ public void completed(final AsyncExecRuntime execRuntime) {
final HttpHost proxy = route.getProxyHost(); final HttpHost proxy = route.getProxyHost();
tracker.connectProxy(proxy, route.isSecure() && !route.isTunnelled()); tracker.connectProxy(proxy, route.isSecure() && !route.isTunnelled());
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": connected to proxy"); log.debug("{}: connected to proxy", exchangeId);
} }
proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback); proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback);
} }
@ -264,7 +264,7 @@ public void handleInformationResponse(
@Override @Override
public void completed() { public void completed() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": tunnel to target created"); log.debug("{}: tunnel to target created", exchangeId);
} }
tracker.tunnelTarget(false); tracker.tunnelTarget(false);
proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback); proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback);
@ -292,7 +292,7 @@ public void failed(final Exception cause) {
case HttpRouteDirector.LAYER_PROTOCOL: case HttpRouteDirector.LAYER_PROTOCOL:
execRuntime.upgradeTls(clientContext); execRuntime.upgradeTls(clientContext);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": upgraded to TLS"); log.debug("{}: upgraded to TLS", exchangeId);
} }
tracker.layerProtocol(route.isSecure()); tracker.layerProtocol(route.isSecure());
break; break;
@ -304,7 +304,7 @@ public void failed(final Exception cause) {
case HttpRouteDirector.COMPLETE: case HttpRouteDirector.COMPLETE:
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": route fully established"); log.debug("{}: route fully established", exchangeId);
} }
try { try {
chain.proceed(request, entityProducer, scope, asyncExecCallback); chain.proceed(request, entityProducer, scope, asyncExecCallback);

View File

@ -165,13 +165,13 @@ private void internalExecute(
if (!request.containsHeader(HttpHeaders.AUTHORIZATION)) { if (!request.containsHeader(HttpHeaders.AUTHORIZATION)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": target auth state: " + targetAuthExchange.getState()); log.debug("{}: target auth state: {}", exchangeId, targetAuthExchange.getState());
} }
authenticator.addAuthResponse(target, ChallengeType.TARGET, request, targetAuthExchange, clientContext); authenticator.addAuthResponse(target, ChallengeType.TARGET, request, targetAuthExchange, clientContext);
} }
if (!request.containsHeader(HttpHeaders.PROXY_AUTHORIZATION) && !route.isTunnelled()) { if (!request.containsHeader(HttpHeaders.PROXY_AUTHORIZATION) && !route.isTunnelled()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": proxy auth state: " + proxyAuthExchange.getState()); log.debug("{}: proxy auth state: {}", exchangeId, proxyAuthExchange.getState());
} }
authenticator.addAuthResponse(proxy, ChallengeType.PROXY, request, proxyAuthExchange, clientContext); authenticator.addAuthResponse(proxy, ChallengeType.PROXY, request, proxyAuthExchange, clientContext);
} }
@ -210,14 +210,14 @@ public void completed() {
if (proxyAuthExchange.getState() == AuthExchange.State.SUCCESS if (proxyAuthExchange.getState() == AuthExchange.State.SUCCESS
&& proxyAuthExchange.isConnectionBased()) { && proxyAuthExchange.isConnectionBased()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting proxy auth state"); log.debug("{}: resetting proxy auth state", exchangeId);
} }
proxyAuthExchange.reset(); proxyAuthExchange.reset();
} }
if (targetAuthExchange.getState() == AuthExchange.State.SUCCESS if (targetAuthExchange.getState() == AuthExchange.State.SUCCESS
&& targetAuthExchange.isConnectionBased()) { && targetAuthExchange.isConnectionBased()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting target auth state"); log.debug("{}: resetting target auth state", exchangeId);
} }
targetAuthExchange.reset(); targetAuthExchange.reset();
} }
@ -226,7 +226,7 @@ public void completed() {
if (challenged.get()) { if (challenged.get()) {
if (entityProducer != null && !entityProducer.isRepeatable()) { if (entityProducer != null && !entityProducer.isRepeatable()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": cannot retry non-repeatable request"); log.debug("{}: cannot retry non-repeatable request", exchangeId);
} }
asyncExecCallback.completed(); asyncExecCallback.completed();
} else { } else {

View File

@ -127,7 +127,7 @@ public AsyncDataConsumer handleResponse(
final URI redirectUri = redirectStrategy.getLocationURI(request, response, clientContext); final URI redirectUri = redirectStrategy.getLocationURI(request, response, clientContext);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": redirect requested to location '" + redirectUri + "'"); log.debug("{}: redirect requested to location '{}'", exchangeId, redirectUri);
} }
if (!config.isCircularRedirectsAllowed()) { if (!config.isCircularRedirectsAllowed()) {
if (state.redirectLocations.contains(redirectUri)) { if (state.redirectLocations.contains(redirectUri)) {
@ -171,14 +171,14 @@ public AsyncDataConsumer handleResponse(
state.reroute = true; state.reroute = true;
final AuthExchange targetAuthExchange = clientContext.getAuthExchange(currentRoute.getTargetHost()); final AuthExchange targetAuthExchange = clientContext.getAuthExchange(currentRoute.getTargetHost());
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting target auth state"); log.debug("{}: resetting target auth state", exchangeId);
} }
targetAuthExchange.reset(); targetAuthExchange.reset();
if (currentRoute.getProxyHost() != null) { if (currentRoute.getProxyHost() != null) {
final AuthExchange proxyAuthExchange = clientContext.getAuthExchange(currentRoute.getProxyHost()); final AuthExchange proxyAuthExchange = clientContext.getAuthExchange(currentRoute.getProxyHost());
if (proxyAuthExchange.isConnectionBased()) { if (proxyAuthExchange.isConnectionBased()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting proxy auth state"); log.debug("{}: resetting proxy auth state", exchangeId);
} }
proxyAuthExchange.reset(); proxyAuthExchange.reset();
} }
@ -190,7 +190,7 @@ public AsyncDataConsumer handleResponse(
} }
if (state.redirectURI != null) { if (state.redirectURI != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": redirecting to '" + state.redirectURI + "' via " + currentRoute); log.debug("{}: redirecting to '{}' via {}", exchangeId, state.redirectURI, currentRoute);
} }
return null; return null;
} }
@ -211,7 +211,7 @@ public void completed() {
final AsyncEntityProducer entityProducer = state.currentEntityProducer; final AsyncEntityProducer entityProducer = state.currentEntityProducer;
if (entityProducer != null && !entityProducer.isRepeatable()) { if (entityProducer != null && !entityProducer.isRepeatable()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": cannot redirect non-repeatable request"); log.debug("{}: cannot redirect non-repeatable request", exchangeId);
} }
asyncExecCallback.completed(); asyncExecCallback.completed();
} else { } else {

View File

@ -118,7 +118,7 @@ private void logFlowControl(final String prefix, final int streamId, final int d
public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) { public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (headerLog.isDebugEnabled()) { if (headerLog.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
headerLog.debug(id + " << " + headers.get(i)); headerLog.debug("{} << {}", id, headers.get(i));
} }
} }
} }
@ -127,7 +127,7 @@ public void onHeaderInput(final HttpConnection connection, final int streamId, f
public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) { public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (headerLog.isDebugEnabled()) { if (headerLog.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
headerLog.debug(id + " >> " + headers.get(i)); headerLog.debug("{} >> {}", id, headers.get(i));
} }
} }
} }

View File

@ -83,7 +83,7 @@ public void execute(
final AsyncExecRuntime execRuntime = scope.execRuntime; final AsyncExecRuntime execRuntime = scope.execRuntime;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": executing " + new RequestLine(request)); log.debug("{}: executing {}", exchangeId, new RequestLine(request));
} }
final AsyncClientExchangeHandler internalExchangeHandler = new AsyncClientExchangeHandler() { final AsyncClientExchangeHandler internalExchangeHandler = new AsyncClientExchangeHandler() {

View File

@ -121,9 +121,9 @@ public IOEventHandler createHandler(final ProtocolIOSession ioSession, final Obj
@Override @Override
public void onRequestHead(final HttpConnection connection, final HttpRequest request) { public void onRequestHead(final HttpConnection connection, final HttpRequest request) {
if (headerLog.isDebugEnabled()) { if (headerLog.isDebugEnabled()) {
headerLog.debug(id + " >> " + new RequestLine(request)); headerLog.debug("{} >> {}", id, new RequestLine(request));
for (final Iterator<Header> it = request.headerIterator(); it.hasNext(); ) { for (final Iterator<Header> it = request.headerIterator(); it.hasNext(); ) {
headerLog.debug(id + " >> " + it.next()); headerLog.debug("{} >> {}", id, it.next());
} }
} }
} }
@ -131,9 +131,9 @@ public void onRequestHead(final HttpConnection connection, final HttpRequest req
@Override @Override
public void onResponseHead(final HttpConnection connection, final HttpResponse response) { public void onResponseHead(final HttpConnection connection, final HttpResponse response) {
if (headerLog.isDebugEnabled()) { if (headerLog.isDebugEnabled()) {
headerLog.debug(id + " << " + new StatusLine(response)); headerLog.debug("{} << {}", id, new StatusLine(response));
for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) {
headerLog.debug(id + " << " + it.next()); headerLog.debug("{} << {}", id, it.next());
} }
} }
} }
@ -142,9 +142,9 @@ public void onResponseHead(final HttpConnection connection, final HttpResponse r
public void onExchangeComplete(final HttpConnection connection, final boolean keepAlive) { public void onExchangeComplete(final HttpConnection connection, final boolean keepAlive) {
if (streamLog.isDebugEnabled()) { if (streamLog.isDebugEnabled()) {
if (keepAlive) { if (keepAlive) {
streamLog.debug(id + " Connection is kept alive"); streamLog.debug("{} Connection is kept alive", id);
} else { } else {
streamLog.debug(id + " Connection is not kept alive"); streamLog.debug("{} Connection is not kept alive", id);
} }
} }
} }
@ -189,7 +189,7 @@ private void logFlowControl(final String prefix, final int streamId, final int d
public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) { public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (headerLog.isDebugEnabled()) { if (headerLog.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
headerLog.debug(id + " << " + headers.get(i)); headerLog.debug("{} << {}", id, headers.get(i));
} }
} }
} }
@ -198,7 +198,7 @@ public void onHeaderInput(final HttpConnection connection, final int streamId, f
public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) { public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (headerLog.isDebugEnabled()) { if (headerLog.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
headerLog.debug(id + " >> " + headers.get(i)); headerLog.debug("{} >> {}", id, headers.get(i));
} }
} }
} }

View File

@ -98,7 +98,7 @@ public void execute(
final AsyncExecRuntime execRuntime = scope.execRuntime; final AsyncExecRuntime execRuntime = scope.execRuntime;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": executing " + new RequestLine(request)); log.debug("{}: executing {}", exchangeId, new RequestLine(request));
} }
final AtomicInteger messageCountDown = new AtomicInteger(2); final AtomicInteger messageCountDown = new AtomicInteger(2);

View File

@ -177,7 +177,7 @@ public void sendRequest(
clientContext); clientContext);
final String exchangeId = ExecSupport.getNextExchangeId(); final String exchangeId = ExecSupport.getNextExchangeId();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": preparing request execution"); log.debug("{}: preparing request execution", exchangeId);
} }
final AsyncExecRuntime execRuntime = createAsyncExecRuntime(pushHandlerFactory); final AsyncExecRuntime execRuntime = createAsyncExecRuntime(pushHandlerFactory);
@ -287,7 +287,7 @@ public void handleInformationResponse(
@Override @Override
public void completed() { public void completed() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": message exchange successfully completed"); log.debug("{}: message exchange successfully completed", exchangeId);
} }
try { try {
execRuntime.releaseEndpoint(); execRuntime.releaseEndpoint();
@ -300,7 +300,7 @@ public void completed() {
@Override @Override
public void failed(final Exception cause) { public void failed(final Exception cause) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": request failed: " + cause.getMessage()); log.debug("{}: request failed: {}", exchangeId, cause.getMessage());
} }
try { try {
execRuntime.discardEndpoint(); execRuntime.discardEndpoint();

View File

@ -89,7 +89,7 @@ public Cancellable acquireEndpoint(
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout connectTimeout = requestConfig.getConnectTimeout(); final Timeout connectTimeout = requestConfig.getConnectTimeout();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquiring endpoint (" + connectTimeout + ")"); log.debug("{}: acquiring endpoint ({})", id, connectTimeout);
} }
return Operations.cancellable(connPool.getSession( return Operations.cancellable(connPool.getSession(
target, target,
@ -101,7 +101,7 @@ public void completed(final IOSession ioSession) {
sessionRef.set(new Endpoint(target, ioSession)); sessionRef.set(new Endpoint(target, ioSession));
reusable = true; reusable = true;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquired endpoint"); log.debug("{}: acquired endpoint", id);
} }
callback.completed(InternalH2AsyncExecRuntime.this); callback.completed(InternalH2AsyncExecRuntime.this);
} }
@ -125,7 +125,7 @@ public void cancelled() {
private void closeEndpoint(final Endpoint endpoint) { private void closeEndpoint(final Endpoint endpoint) {
endpoint.session.close(CloseMode.GRACEFUL); endpoint.session.close(CloseMode.GRACEFUL);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint closed"); log.debug("{}: endpoint closed", ConnPoolSupport.getId(endpoint));
} }
} }
@ -186,7 +186,7 @@ public Cancellable connectEndpoint(
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout connectTimeout = requestConfig.getConnectTimeout(); final Timeout connectTimeout = requestConfig.getConnectTimeout();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connecting endpoint (" + connectTimeout + ")"); log.debug("{}: connecting endpoint ({})", ConnPoolSupport.getId(endpoint), connectTimeout);
} }
return Operations.cancellable(connPool.getSession(target, connectTimeout, return Operations.cancellable(connPool.getSession(target, connectTimeout,
new FutureCallback<IOSession>() { new FutureCallback<IOSession>() {
@ -196,7 +196,7 @@ public void completed(final IOSession ioSession) {
sessionRef.set(new Endpoint(target, ioSession)); sessionRef.set(new Endpoint(target, ioSession));
reusable = true; reusable = true;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint connected"); log.debug("{}: endpoint connected", ConnPoolSupport.getId(endpoint));
} }
callback.completed(InternalH2AsyncExecRuntime.this); callback.completed(InternalH2AsyncExecRuntime.this);
} }
@ -229,7 +229,7 @@ public Cancellable execute(
final IOSession session = endpoint.session; final IOSession session = endpoint.session;
if (session.isOpen()) { if (session.isOpen()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": start execution " + id); log.debug("{}: start execution {}", ConnPoolSupport.getId(endpoint), id);
} }
session.enqueue( session.enqueue(
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, complexCancellable, context), new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, complexCancellable, context),
@ -245,7 +245,7 @@ public void completed(final IOSession ioSession) {
sessionRef.set(new Endpoint(target, ioSession)); sessionRef.set(new Endpoint(target, ioSession));
reusable = true; reusable = true;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": start execution " + id); log.debug("{}: start execution {}", ConnPoolSupport.getId(endpoint), id);
} }
session.enqueue( session.enqueue(
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, complexCancellable, context), new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, complexCancellable, context),

View File

@ -95,7 +95,7 @@ public Cancellable acquireEndpoint(
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout(); final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquiring endpoint (" + connectionRequestTimeout + ")"); log.debug("{}: acquiring endpoint ({})", id, connectionRequestTimeout);
} }
return Operations.cancellable(manager.lease( return Operations.cancellable(manager.lease(
id, id,
@ -109,7 +109,7 @@ public void completed(final AsyncConnectionEndpoint connectionEndpoint) {
endpointRef.set(connectionEndpoint); endpointRef.set(connectionEndpoint);
reusable = connectionEndpoint.isConnected(); reusable = connectionEndpoint.isConnected();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquired endpoint " + ConnPoolSupport.getId(connectionEndpoint)); log.debug("{}: acquired endpoint {}", id, ConnPoolSupport.getId(connectionEndpoint));
} }
callback.completed(InternalHttpAsyncExecRuntime.this); callback.completed(InternalHttpAsyncExecRuntime.this);
} }
@ -133,11 +133,11 @@ private void discardEndpoint(final AsyncConnectionEndpoint endpoint) {
try { try {
endpoint.close(CloseMode.IMMEDIATE); endpoint.close(CloseMode.IMMEDIATE);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint closed"); log.debug("{}: endpoint closed", ConnPoolSupport.getId(endpoint));
} }
} finally { } finally {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": discarding endpoint"); log.debug("{}: discarding endpoint", ConnPoolSupport.getId(endpoint));
} }
manager.release(endpoint, null, TimeValue.ZERO_MILLISECONDS); manager.release(endpoint, null, TimeValue.ZERO_MILLISECONDS);
} }
@ -149,7 +149,7 @@ public void releaseEndpoint() {
if (endpoint != null) { if (endpoint != null) {
if (reusable) { if (reusable) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": releasing valid endpoint"); log.debug("{}: releasing valid endpoint", ConnPoolSupport.getId(endpoint));
} }
manager.release(endpoint, state, validDuration); manager.release(endpoint, state, validDuration);
} else { } else {
@ -205,7 +205,7 @@ public Cancellable connectEndpoint(
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout connectTimeout = requestConfig.getConnectTimeout(); final Timeout connectTimeout = requestConfig.getConnectTimeout();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connecting endpoint (" + connectTimeout + ")"); log.debug("{}: connecting endpoint ({})", ConnPoolSupport.getId(endpoint), connectTimeout);
} }
return Operations.cancellable(manager.connect( return Operations.cancellable(manager.connect(
endpoint, endpoint,
@ -218,7 +218,7 @@ public Cancellable connectEndpoint(
@Override @Override
public void completed(final AsyncConnectionEndpoint endpoint) { public void completed(final AsyncConnectionEndpoint endpoint) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint connected"); log.debug("{}: endpoint connected", ConnPoolSupport.getId(endpoint));
} }
callback.completed(InternalHttpAsyncExecRuntime.this); callback.completed(InternalHttpAsyncExecRuntime.this);
} }
@ -241,7 +241,7 @@ public void cancelled() {
public void upgradeTls(final HttpClientContext context) { public void upgradeTls(final HttpClientContext context) {
final AsyncConnectionEndpoint endpoint = ensureValid(); final AsyncConnectionEndpoint endpoint = ensureValid();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": upgrading endpoint"); log.debug("{}: upgrading endpoint", ConnPoolSupport.getId(endpoint));
} }
manager.upgrade(endpoint, versionPolicy, context); manager.upgrade(endpoint, versionPolicy, context);
} }
@ -252,7 +252,7 @@ public Cancellable execute(
final AsyncConnectionEndpoint endpoint = ensureValid(); final AsyncConnectionEndpoint endpoint = ensureValid();
if (endpoint.isConnected()) { if (endpoint.isConnected()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": start execution " + id); log.debug("{}: start execution {}", ConnPoolSupport.getId(endpoint), id);
} }
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout responseTimeout = requestConfig.getResponseTimeout(); final Timeout responseTimeout = requestConfig.getResponseTimeout();
@ -275,7 +275,7 @@ public boolean cancel() {
@Override @Override
public void completed(final AsyncExecRuntime runtime) { public void completed(final AsyncExecRuntime runtime) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": start execution " + id); log.debug("{}: start execution {}", ConnPoolSupport.getId(endpoint), id);
} }
try { try {
endpoint.execute(id, exchangeHandler, pushHandlerFactory, context); endpoint.execute(id, exchangeHandler, pushHandlerFactory, context);

View File

@ -60,7 +60,7 @@ public Appendable append(final CharSequence text, final int start, final int end
@Override @Override
public Appendable append(final char ch) throws IOException { public Appendable append(final char ch) throws IOException {
if (ch == '\n') { if (ch == '\n') {
log.debug(prefix + " " + buffer.toString()); log.debug("{} {}", prefix, buffer);
buffer.setLength(0); buffer.setLength(0);
} else if (ch != '\r') { } else if (ch != '\r') {
buffer.append(ch); buffer.append(ch);
@ -70,7 +70,7 @@ public Appendable append(final char ch) throws IOException {
public void flush() { public void flush() {
if (buffer.length() > 0) { if (buffer.length() > 0) {
log.debug(prefix + " " + buffer.toString()); log.debug("{} {}", prefix, buffer);
buffer.setLength(0); buffer.setLength(0);
} }
} }

View File

@ -77,8 +77,7 @@ public void sendRequest(
final EntityDetails entityDetails, final EntityDetails entityDetails,
final HttpContext context) throws HttpException, IOException { final HttpContext context) throws HttpException, IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": send request " + new RequestLine(request) + ", " + log.debug("{}: send request {}, {}", exchangeId, new RequestLine(request), entityDetails != null ? "entity len " + entityDetails.getContentLength() : "null entity");
(entityDetails != null ? "entity len " + entityDetails.getContentLength() : "null entity"));
} }
channel.sendRequest(request, entityDetails, context); channel.sendRequest(request, entityDetails, context);
} }
@ -94,7 +93,7 @@ public int available() {
@Override @Override
public void produce(final DataStreamChannel channel) throws IOException { public void produce(final DataStreamChannel channel) throws IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": produce request data"); log.debug("{}: produce request data", exchangeId);
} }
handler.produce(new DataStreamChannel() { handler.produce(new DataStreamChannel() {
@ -106,7 +105,7 @@ public void requestOutput() {
@Override @Override
public int write(final ByteBuffer src) throws IOException { public int write(final ByteBuffer src) throws IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": produce request data, len " + src.remaining() + " bytes"); log.debug("{}: produce request data, len {} bytes", exchangeId, src.remaining());
} }
return channel.write(src); return channel.write(src);
} }
@ -114,7 +113,7 @@ public int write(final ByteBuffer src) throws IOException {
@Override @Override
public void endStream() throws IOException { public void endStream() throws IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": end of request data"); log.debug("{}: end of request data", exchangeId);
} }
channel.endStream(); channel.endStream();
} }
@ -122,7 +121,7 @@ public void endStream() throws IOException {
@Override @Override
public void endStream(final List<? extends Header> trailers) throws IOException { public void endStream(final List<? extends Header> trailers) throws IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": end of request data"); log.debug("{}: end of request data", exchangeId);
} }
channel.endStream(trailers); channel.endStream(trailers);
} }
@ -135,7 +134,7 @@ public void consumeInformation(
final HttpResponse response, final HttpResponse response,
final HttpContext context) throws HttpException, IOException { final HttpContext context) throws HttpException, IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": information response " + new StatusLine(response)); log.debug("{}: information response {}", exchangeId, new StatusLine(response));
} }
handler.consumeInformation(response, context); handler.consumeInformation(response, context);
} }
@ -146,8 +145,7 @@ public void consumeResponse(
final EntityDetails entityDetails, final EntityDetails entityDetails,
final HttpContext context) throws HttpException, IOException { final HttpContext context) throws HttpException, IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": consume response " + new StatusLine(response) + ", " + log.debug("{}: consume response {}, {}", exchangeId, new StatusLine(response), entityDetails != null ? "entity len " + entityDetails.getContentLength() : " null entity");
(entityDetails != null ? "entity len " + entityDetails.getContentLength() : " null entity"));
} }
handler.consumeResponse(response, entityDetails, context); handler.consumeResponse(response, entityDetails, context);
} }
@ -160,7 +158,7 @@ public void updateCapacity(final CapacityChannel capacityChannel) throws IOExcep
@Override @Override
public void update(final int increment) throws IOException { public void update(final int increment) throws IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": capacity update " + increment); log.debug("{}: capacity update {}", exchangeId, increment);
} }
capacityChannel.update(increment); capacityChannel.update(increment);
} }
@ -171,7 +169,7 @@ public void update(final int increment) throws IOException {
@Override @Override
public void consume(final ByteBuffer src) throws IOException { public void consume(final ByteBuffer src) throws IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": consume response data, len " + src.remaining() + " bytes"); log.debug("{}: consume response data, len {} bytes", exchangeId, src.remaining());
} }
handler.consume(src); handler.consume(src);
} }
@ -179,7 +177,7 @@ public void consume(final ByteBuffer src) throws IOException {
@Override @Override
public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": end of response data"); log.debug("{}: end of response data", exchangeId);
} }
handler.streamEnd(trailers); handler.streamEnd(trailers);
} }
@ -187,7 +185,7 @@ public void streamEnd(final List<? extends Header> trailers) throws HttpExceptio
@Override @Override
public void failed(final Exception cause) { public void failed(final Exception cause) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": execution failed: " + cause.getMessage()); log.debug("{}: execution failed: {}", exchangeId, cause.getMessage());
} }
handler.failed(cause); handler.failed(cause);
} }
@ -195,7 +193,7 @@ public void failed(final Exception cause) {
@Override @Override
public void cancel() { public void cancel() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": execution cancelled"); log.debug("{}: execution cancelled", exchangeId);
} }
handler.cancel(); handler.cancel();
} }

View File

@ -81,7 +81,7 @@ public Command poll() {
public void enqueue(final Command command, final Command.Priority priority) { public void enqueue(final Command command, final Command.Priority priority) {
this.session.enqueue(command, priority); this.session.enqueue(command, priority);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.session + " Enqueued " + command.getClass().getSimpleName() + " with priority " + priority); this.log.debug("{} Enqueued {} with priority {}", this.session, command.getClass().getSimpleName(), priority);
} }
} }
@ -128,7 +128,7 @@ private static String formatOps(final int ops) {
public void setEventMask(final int ops) { public void setEventMask(final int ops) {
this.session.setEventMask(ops); this.session.setEventMask(ops);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Event mask set " + formatOps(ops)); this.log.debug("{} {}: Event mask set {}", this.id, this.session, formatOps(ops));
} }
} }
@ -136,7 +136,7 @@ public void setEventMask(final int ops) {
public void setEvent(final int op) { public void setEvent(final int op) {
this.session.setEvent(op); this.session.setEvent(op);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Event set " + formatOps(op)); this.log.debug("{} {}: Event set {}", this.id, this.session, formatOps(op));
} }
} }
@ -144,7 +144,7 @@ public void setEvent(final int op) {
public void clearEvent(final int op) { public void clearEvent(final int op) {
this.session.clearEvent(op); this.session.clearEvent(op);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Event cleared " + formatOps(op)); this.log.debug("{} {}: Event cleared {}", this.id, this.session, formatOps(op));
} }
} }
@ -156,7 +156,7 @@ public boolean isOpen() {
@Override @Override
public void close() { public void close() {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Close"); this.log.debug("{} {}: Close", this.id, this.session);
} }
this.session.close(); this.session.close();
} }
@ -169,7 +169,7 @@ public Status getStatus() {
@Override @Override
public void close(final CloseMode closeMode) { public void close(final CloseMode closeMode) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Close " + closeMode); this.log.debug("{} {}: Close {}", this.id, this.session, closeMode);
} }
this.session.close(closeMode); this.session.close(closeMode);
} }
@ -182,7 +182,7 @@ public Timeout getSocketTimeout() {
@Override @Override
public void setSocketTimeout(final Timeout timeout) { public void setSocketTimeout(final Timeout timeout) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Set timeout " + timeout); this.log.debug("{} {}: Set timeout {}", this.id, this.session, timeout);
} }
this.session.setSocketTimeout(timeout); this.session.setSocketTimeout(timeout);
} }
@ -226,7 +226,7 @@ public void upgrade(final IOEventHandler handler) {
public int read(final ByteBuffer dst) throws IOException { public int read(final ByteBuffer dst) throws IOException {
final int bytesRead = this.session.channel().read(dst); final int bytesRead = this.session.channel().read(dst);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": " + bytesRead + " bytes read"); this.log.debug("{} {}: {} bytes read", this.id, this.session, bytesRead);
} }
if (bytesRead > 0 && this.wireLog.isEnabled()) { if (bytesRead > 0 && this.wireLog.isEnabled()) {
final ByteBuffer b = dst.duplicate(); final ByteBuffer b = dst.duplicate();
@ -243,7 +243,7 @@ public int read(final ByteBuffer dst) throws IOException {
public int write(final ByteBuffer src) throws IOException { public int write(final ByteBuffer src) throws IOException {
final int byteWritten = session.channel().write(src); final int byteWritten = session.channel().write(src);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": " + byteWritten + " bytes written"); this.log.debug("{} {}: {} bytes written", this.id, this.session, byteWritten);
} }
if (byteWritten > 0 && this.wireLog.isEnabled()) { if (byteWritten > 0 && this.wireLog.isEnabled()) {
final ByteBuffer b = src.duplicate(); final ByteBuffer b = src.duplicate();
@ -257,7 +257,7 @@ public int write(final ByteBuffer src) throws IOException {
@Override @Override
public String toString() { public String toString() {
return this.id + " " + this.session.toString(); return this.id + " " + this.session;
} }
} }

View File

@ -232,7 +232,7 @@ public void streamEnd(final List<? extends Header> trailers) throws HttpExceptio
}; };
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
final String exchangeId = ExecSupport.getNextExchangeId(); final String exchangeId = ExecSupport.getNextExchangeId();
log.debug(ConnPoolSupport.getId(session) + ": executing message exchange " + exchangeId); log.debug("{}: executing message exchange {}", ConnPoolSupport.getId(session), exchangeId);
session.enqueue( session.enqueue(
new RequestExecutionCommand( new RequestExecutionCommand(
new LoggingAsyncClientExchangeHandler(log, exchangeId, internalExchangeHandler), new LoggingAsyncClientExchangeHandler(log, exchangeId, internalExchangeHandler),

View File

@ -466,7 +466,7 @@ public void execute(
final String exchangeId = ExecSupport.getNextExchangeId(); final String exchangeId = ExecSupport.getNextExchangeId();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(connectionEndpoint) + ": executing message exchange " + exchangeId); log.debug("{}: executing message exchange {}", ConnPoolSupport.getId(connectionEndpoint), exchangeId);
connectionEndpoint.execute( connectionEndpoint.execute(
exchangeId, exchangeId,
new LoggingAsyncClientExchangeHandler(log, exchangeId, exchangeHandler), new LoggingAsyncClientExchangeHandler(log, exchangeId, exchangeHandler),

View File

@ -101,7 +101,7 @@ public void put(final HttpHost host, final AuthScheme authScheme) {
} }
} else { } else {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Auth scheme " + authScheme.getClass() + " is not serializable"); log.debug("Auth scheme {} is not serializable", authScheme.getClass());
} }
} }
} }

View File

@ -197,7 +197,7 @@ private void readObjectNoData() {
@Override @Override
public String toString() { public String toString() {
return getName() + this.paramMap.toString(); return getName() + this.paramMap;
} }
} }

View File

@ -465,7 +465,7 @@ static byte[] createCnonce() {
@Override @Override
public String toString() { public String toString() {
return getName() + this.paramMap.toString(); return getName() + this.paramMap;
} }
} }

View File

@ -220,7 +220,7 @@ public String generateAuthResponse(
final String serviceName = host.getSchemeName().toUpperCase(Locale.ROOT); final String serviceName = host.getSchemeName().toUpperCase(Locale.ROOT);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("init " + authServer); log.debug("init {}", authServer);
} }
token = generateToken(token, serviceName, authServer); token = generateToken(token, serviceName, authServer);
state = State.TOKEN_GENERATED; state = State.TOKEN_GENERATED;
@ -245,7 +245,7 @@ public String generateAuthResponse(
final Base64 codec = new Base64(0); final Base64 codec = new Base64(0);
final String tokenstr = new String(codec.encode(token)); final String tokenstr = new String(codec.encode(token));
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Sending response '" + tokenstr + "' back to the auth server"); log.debug("Sending response '{}' back to the auth server", tokenstr);
} }
return StandardAuthScheme.SPNEGO + " " + tokenstr; return StandardAuthScheme.SPNEGO + " " + tokenstr;
default: default:

View File

@ -161,7 +161,7 @@ public boolean updateAuthState(
final HttpContext context) { final HttpContext context) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(host.toHostString() + " requested authentication"); this.log.debug("{} requested authentication", host.toHostString());
} }
final HttpClientContext clientContext = HttpClientContext.adapt(context); final HttpClientContext clientContext = HttpClientContext.adapt(context);
@ -190,7 +190,7 @@ public boolean updateAuthState(
authChallenges = parser.parse(challengeType, buffer, cursor); authChallenges = parser.parse(challengeType, buffer, cursor);
} catch (final ParseException ex) { } catch (final ParseException ex) {
if (this.log.isWarnEnabled()) { if (this.log.isWarnEnabled()) {
this.log.warn("Malformed challenge: " + header.getValue()); this.log.warn("Malformed challenge: {}", header.getValue());
} }
continue; continue;
} }
@ -274,7 +274,7 @@ public boolean updateAuthState(
} }
if (!authOptions.isEmpty()) { if (!authOptions.isEmpty()) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Selected authentication options: " + authOptions); this.log.debug("Selected authentication options: {}", authOptions);
} }
authExchange.reset(); authExchange.reset();
authExchange.setState(AuthExchange.State.CHALLENGED); authExchange.setState(AuthExchange.State.CHALLENGED);
@ -320,8 +320,7 @@ public void addAuthResponse(
authScheme = authOptions.remove(); authScheme = authOptions.remove();
authExchange.select(authScheme); authExchange.select(authScheme);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Generating response to an authentication challenge using " this.log.debug("Generating response to an authentication challenge using {} scheme", authScheme.getName());
+ authScheme.getName() + " scheme");
} }
try { try {
final String authResponse = authScheme.generateAuthResponse(host, request, context); final String authResponse = authScheme.generateAuthResponse(host, request, context);
@ -332,7 +331,7 @@ public void addAuthResponse(
break; break;
} catch (final AuthenticationException ex) { } catch (final AuthenticationException ex) {
if (this.log.isWarnEnabled()) { if (this.log.isWarnEnabled()) {
this.log.warn(authScheme + " authentication error: " + ex.getMessage()); this.log.warn("{} authentication error: {}", authScheme, ex.getMessage());
} }
} }
} }
@ -350,7 +349,7 @@ public void addAuthResponse(
request.addHeader(header); request.addHeader(header);
} catch (final AuthenticationException ex) { } catch (final AuthenticationException ex) {
if (this.log.isErrorEnabled()) { if (this.log.isErrorEnabled()) {
this.log.error(authScheme + " authentication error: " + ex.getMessage()); this.log.error("{} authentication error: {}", authScheme, ex.getMessage());
} }
} }
} }
@ -365,7 +364,7 @@ private void updateCache(final HttpHost host, final AuthScheme authScheme, final
clientContext.setAuthCache(authCache); clientContext.setAuthCache(authCache);
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Caching '" + authScheme.getName() + "' auth scheme for " + host); this.log.debug("Caching '{}' auth scheme for {}", authScheme.getName(), host);
} }
authCache.put(host, authScheme); authCache.put(host, authScheme);
} }
@ -376,7 +375,7 @@ private void clearCache(final HttpHost host, final HttpClientContext clientConte
final AuthCache authCache = clientContext.getAuthCache(); final AuthCache authCache = clientContext.getAuthCache();
if (authCache != null) { if (authCache != null) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Clearing cached auth scheme for " + host); this.log.debug("Clearing cached auth scheme for {}", host);
} }
authCache.remove(host); authCache.remove(host);
} }

View File

@ -113,14 +113,14 @@ public ClassicHttpResponse execute(
if (!execRuntime.isEndpointAcquired()) { if (!execRuntime.isEndpointAcquired()) {
final Object userToken = context.getUserToken(); final Object userToken = context.getUserToken();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": acquiring connection with route " + route); log.debug("{}: acquiring connection with route {}", exchangeId, route);
} }
execRuntime.acquireEndpoint(exchangeId, route, userToken, context); execRuntime.acquireEndpoint(exchangeId, route, userToken, context);
} }
try { try {
if (!execRuntime.isEndpointConnected()) { if (!execRuntime.isEndpointConnected()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": opening connection " + route); log.debug("{}: opening connection {}", exchangeId, route);
} }
final RouteTracker tracker = new RouteTracker(route); final RouteTracker tracker = new RouteTracker(route);
@ -143,7 +143,7 @@ public ClassicHttpResponse execute(
case HttpRouteDirector.TUNNEL_TARGET: { case HttpRouteDirector.TUNNEL_TARGET: {
final boolean secure = createTunnelToTarget(exchangeId, route, request, execRuntime, context); final boolean secure = createTunnelToTarget(exchangeId, route, request, execRuntime, context);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": tunnel to target created."); log.debug("{}: tunnel to target created.", exchangeId);
} }
tracker.tunnelTarget(secure); tracker.tunnelTarget(secure);
} break; } break;
@ -156,7 +156,7 @@ public ClassicHttpResponse execute(
final int hop = fact.getHopCount()-1; // the hop to establish final int hop = fact.getHopCount()-1; // the hop to establish
final boolean secure = createTunnelToProxy(route, hop, context); final boolean secure = createTunnelToProxy(route, hop, context);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": tunnel to proxy created."); log.debug("{}: tunnel to proxy created.", exchangeId);
} }
tracker.tunnelProxy(route.getHopTarget(hop), secure); tracker.tunnelProxy(route.getHopTarget(hop), secure);
} break; } break;
@ -234,7 +234,7 @@ private boolean createTunnelToTarget(
// Retry request // Retry request
if (this.reuseStrategy.keepAlive(request, response, context)) { if (this.reuseStrategy.keepAlive(request, response, context)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": connection kept alive"); log.debug("{}: connection kept alive", exchangeId);
} }
// Consume response content // Consume response content
final HttpEntity entity = response.getEntity(); final HttpEntity entity = response.getEntity();

View File

@ -98,7 +98,7 @@ public void acquireEndpoint(
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout(); final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquiring endpoint (" + connectionRequestTimeout + ")"); log.debug("{}: acquiring endpoint ({})", id, connectionRequestTimeout);
} }
final LeaseRequest connRequest = manager.lease(id, route, connectionRequestTimeout, object); final LeaseRequest connRequest = manager.lease(id, route, connectionRequestTimeout, object);
state = object; state = object;
@ -117,7 +117,7 @@ public void acquireEndpoint(
cancellableDependency.setDependency(this); cancellableDependency.setDependency(this);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquired endpoint " + ConnPoolSupport.getId(connectionEndpoint)); log.debug("{}: acquired endpoint {}", id, ConnPoolSupport.getId(connectionEndpoint));
} }
} catch(final TimeoutException ex) { } catch(final TimeoutException ex) {
throw new ConnectionRequestTimeoutException(ex.getMessage()); throw new ConnectionRequestTimeoutException(ex.getMessage());
@ -159,11 +159,11 @@ private void connectEndpoint(final ConnectionEndpoint endpoint, final HttpClient
final RequestConfig requestConfig = context.getRequestConfig(); final RequestConfig requestConfig = context.getRequestConfig();
final Timeout connectTimeout = requestConfig.getConnectTimeout(); final Timeout connectTimeout = requestConfig.getConnectTimeout();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connecting endpoint (" + connectTimeout + ")"); log.debug("{}: connecting endpoint ({})", ConnPoolSupport.getId(endpoint), connectTimeout);
} }
manager.connect(endpoint, connectTimeout, context); manager.connect(endpoint, connectTimeout, context);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint connected"); log.debug("{}: endpoint connected", ConnPoolSupport.getId(endpoint));
} }
} }
@ -181,7 +181,7 @@ public void disconnectEndpoint() throws IOException {
if (endpoint != null) { if (endpoint != null) {
endpoint.close(); endpoint.close();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint closed"); log.debug("{}: endpoint closed", ConnPoolSupport.getId(endpoint));
} }
} }
} }
@ -190,7 +190,7 @@ public void disconnectEndpoint() throws IOException {
public void upgradeTls(final HttpClientContext context) throws IOException { public void upgradeTls(final HttpClientContext context) throws IOException {
final ConnectionEndpoint endpoint = ensureValid(); final ConnectionEndpoint endpoint = ensureValid();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": upgrading endpoint"); log.debug("{}: upgrading endpoint", ConnPoolSupport.getId(endpoint));
} }
manager.upgrade(endpoint, context); manager.upgrade(endpoint, context);
} }
@ -210,7 +210,7 @@ public ClassicHttpResponse execute(
endpoint.setSocketTimeout(responseTimeout); endpoint.setSocketTimeout(responseTimeout);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": start execution " + id); log.debug("{}: start execution {}", ConnPoolSupport.getId(endpoint), id);
} }
return endpoint.execute(id, request, requestExecutor, context); return endpoint.execute(id, request, requestExecutor, context);
} }
@ -236,11 +236,11 @@ private void discardEndpoint(final ConnectionEndpoint endpoint) {
try { try {
endpoint.close(CloseMode.IMMEDIATE); endpoint.close(CloseMode.IMMEDIATE);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": endpoint closed"); log.debug("{}: endpoint closed", ConnPoolSupport.getId(endpoint));
} }
} finally { } finally {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": discarding endpoint"); log.debug("{}: discarding endpoint", ConnPoolSupport.getId(endpoint));
} }
manager.release(endpoint, null, TimeValue.ZERO_MILLISECONDS); manager.release(endpoint, null, TimeValue.ZERO_MILLISECONDS);
} }
@ -252,7 +252,7 @@ public void releaseEndpoint() {
if (endpoint != null) { if (endpoint != null) {
if (reusable) { if (reusable) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": releasing valid endpoint"); log.debug("{}: releasing valid endpoint", ConnPoolSupport.getId(endpoint));
} }
manager.release(endpoint, state, validDuration); manager.release(endpoint, state, validDuration);
} else { } else {
@ -275,7 +275,7 @@ public boolean cancel() {
final ConnectionEndpoint endpoint = endpointRef.getAndSet(null); final ConnectionEndpoint endpoint = endpointRef.getAndSet(null);
if (endpoint != null) { if (endpoint != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": cancel"); log.debug("{}: cancel", ConnPoolSupport.getId(endpoint));
} }
discardEndpoint(endpoint); discardEndpoint(endpoint);
} }

View File

@ -169,7 +169,7 @@ protected CloseableHttpResponse doExecute(
final HttpRoute route = determineRoute(target, request, localcontext); final HttpRoute route = determineRoute(target, request, localcontext);
final String exchangeId = ExecSupport.getNextExchangeId(); final String exchangeId = ExecSupport.getNextExchangeId();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": preparing request execution"); log.debug("{}: preparing request execution", exchangeId);
} }
final ExecRuntime execRuntime = new InternalExecRuntime(log, connManager, requestExecutor, final ExecRuntime execRuntime = new InternalExecRuntime(log, connManager, requestExecutor,

View File

@ -99,7 +99,7 @@ public ClassicHttpResponse execute(
final ExecRuntime execRuntime = scope.execRuntime; final ExecRuntime execRuntime = scope.execRuntime;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": executing " + new RequestLine(request)); log.debug("{}: executing {}", exchangeId, new RequestLine(request));
} }
try { try {
RequestEntityProxy.enhance(request); RequestEntityProxy.enhance(request);
@ -123,7 +123,7 @@ public ClassicHttpResponse execute(
} else { } else {
s = "indefinitely"; s = "indefinitely";
} }
this.log.debug(exchangeId + ": connection can be kept alive " + s); this.log.debug("{}: connection can be kept alive {}", exchangeId, s);
} }
execRuntime.markConnectionReusable(userToken, duration); execRuntime.markConnectionReusable(userToken, duration);
} else { } else {

View File

@ -155,13 +155,13 @@ public ClassicHttpResponse execute(
if (!request.containsHeader(HttpHeaders.AUTHORIZATION)) { if (!request.containsHeader(HttpHeaders.AUTHORIZATION)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": target auth state: " + targetAuthExchange.getState()); log.debug("{}: target auth state: {}", exchangeId, targetAuthExchange.getState());
} }
authenticator.addAuthResponse(target, ChallengeType.TARGET, request, targetAuthExchange, context); authenticator.addAuthResponse(target, ChallengeType.TARGET, request, targetAuthExchange, context);
} }
if (!request.containsHeader(HttpHeaders.PROXY_AUTHORIZATION) && !route.isTunnelled()) { if (!request.containsHeader(HttpHeaders.PROXY_AUTHORIZATION) && !route.isTunnelled()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": proxy auth state: " + proxyAuthExchange.getState()); log.debug("{}: proxy auth state: {}", exchangeId, proxyAuthExchange.getState());
} }
authenticator.addAuthResponse(proxy, ChallengeType.PROXY, request, proxyAuthExchange, context); authenticator.addAuthResponse(proxy, ChallengeType.PROXY, request, proxyAuthExchange, context);
} }
@ -178,7 +178,7 @@ public ClassicHttpResponse execute(
final HttpEntity requestEntity = request.getEntity(); final HttpEntity requestEntity = request.getEntity();
if (requestEntity != null && !requestEntity.isRepeatable()) { if (requestEntity != null && !requestEntity.isRepeatable()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": Cannot retry non-repeatable request"); log.debug("{}: Cannot retry non-repeatable request", exchangeId);
} }
return response; return response;
} }
@ -192,14 +192,14 @@ public ClassicHttpResponse execute(
if (proxyAuthExchange.getState() == AuthExchange.State.SUCCESS if (proxyAuthExchange.getState() == AuthExchange.State.SUCCESS
&& proxyAuthExchange.isConnectionBased()) { && proxyAuthExchange.isConnectionBased()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting proxy auth state"); log.debug("{}: resetting proxy auth state", exchangeId);
} }
proxyAuthExchange.reset(); proxyAuthExchange.reset();
} }
if (targetAuthExchange.getState() == AuthExchange.State.SUCCESS if (targetAuthExchange.getState() == AuthExchange.State.SUCCESS
&& targetAuthExchange.isConnectionBased()) { && targetAuthExchange.isConnectionBased()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting target auth state"); log.debug("{}: resetting target auth state", exchangeId);
} }
targetAuthExchange.reset(); targetAuthExchange.reset();
} }

View File

@ -119,7 +119,7 @@ public ClassicHttpResponse execute(
final HttpEntity requestEntity = request.getEntity(); final HttpEntity requestEntity = request.getEntity();
if (requestEntity != null && !requestEntity.isRepeatable()) { if (requestEntity != null && !requestEntity.isRepeatable()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": cannot redirect non-repeatable request"); log.debug("{}: cannot redirect non-repeatable request", exchangeId);
} }
return response; return response;
} }
@ -130,7 +130,7 @@ public ClassicHttpResponse execute(
final URI redirectUri = this.redirectStrategy.getLocationURI(currentRequest, response, context); final URI redirectUri = this.redirectStrategy.getLocationURI(currentRequest, response, context);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": redirect requested to location '" + redirectUri + "'"); log.debug("{}: redirect requested to location '{}'", exchangeId, redirectUri);
} }
if (!config.isCircularRedirectsAllowed()) { if (!config.isCircularRedirectsAllowed()) {
if (redirectLocations.contains(redirectUri)) { if (redirectLocations.contains(redirectUri)) {
@ -171,18 +171,18 @@ public ClassicHttpResponse execute(
final HttpRoute newRoute = this.routePlanner.determineRoute(newTarget, context); final HttpRoute newRoute = this.routePlanner.determineRoute(newTarget, context);
if (!LangUtils.equals(currentRoute, newRoute)) { if (!LangUtils.equals(currentRoute, newRoute)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": new route required"); log.debug("{}: new route required", exchangeId);
} }
final AuthExchange targetAuthExchange = context.getAuthExchange(currentRoute.getTargetHost()); final AuthExchange targetAuthExchange = context.getAuthExchange(currentRoute.getTargetHost());
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting target auth state"); log.debug("{}: resetting target auth state", exchangeId);
} }
targetAuthExchange.reset(); targetAuthExchange.reset();
if (currentRoute.getProxyHost() != null) { if (currentRoute.getProxyHost() != null) {
final AuthExchange proxyAuthExchange = context.getAuthExchange(currentRoute.getProxyHost()); final AuthExchange proxyAuthExchange = context.getAuthExchange(currentRoute.getProxyHost());
if (proxyAuthExchange.isConnectionBased()) { if (proxyAuthExchange.isConnectionBased()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": resetting proxy auth state"); log.debug("{}: resetting proxy auth state", exchangeId);
} }
proxyAuthExchange.reset(); proxyAuthExchange.reset();
} }
@ -197,7 +197,7 @@ public ClassicHttpResponse execute(
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": redirecting to '" + redirectUri + "' via " + currentRoute); log.debug("{}: redirecting to '{}' via {}", exchangeId, redirectUri, currentRoute);
} }
currentRequest = redirect; currentRequest = redirect;
RequestEntityProxy.enhance(currentRequest); RequestEntityProxy.enhance(currentRequest);
@ -217,7 +217,7 @@ public ClassicHttpResponse execute(
EntityUtils.consume(response.getEntity()); EntityUtils.consume(response.getEntity());
} catch (final IOException ioex) { } catch (final IOException ioex) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(exchangeId + ": I/O error while releasing connection", ioex); log.debug("{}: I/O error while releasing connection", exchangeId, ioex);
} }
} finally { } finally {
response.close(); response.close();

View File

@ -112,7 +112,7 @@ public final List<Cookie> parse(final Header header, final CookieOrigin origin)
Args.notNull(header, "Header"); Args.notNull(header, "Header");
Args.notNull(origin, "Cookie origin"); Args.notNull(origin, "Cookie origin");
if (!header.getName().equalsIgnoreCase("Set-Cookie")) { if (!header.getName().equalsIgnoreCase("Set-Cookie")) {
throw new MalformedCookieException("Unrecognized cookie header: '" + header.toString() + "'"); throw new MalformedCookieException("Unrecognized cookie header: '" + header + "'");
} }
final CharArrayBuffer buffer; final CharArrayBuffer buffer;
final ParserCursor cursor; final ParserCursor cursor;
@ -138,7 +138,7 @@ public final List<Cookie> parse(final Header header, final CookieOrigin origin)
final int valueDelim = buffer.charAt(cursor.getPos()); final int valueDelim = buffer.charAt(cursor.getPos());
cursor.updatePos(cursor.getPos() + 1); cursor.updatePos(cursor.getPos() + 1);
if (valueDelim != '=') { if (valueDelim != '=') {
throw new MalformedCookieException("Cookie value is invalid: '" + header.toString() + "'"); throw new MalformedCookieException("Cookie value is invalid: '" + header + "'");
} }
final String value = tokenParser.parseValue(buffer, cursor, VALUE_DELIMS); final String value = tokenParser.parseValue(buffer, cursor, VALUE_DELIMS);
if (!cursor.atEnd()) { if (!cursor.atEnd()) {

View File

@ -206,7 +206,7 @@ public boolean cancel() {
private synchronized void closeConnection(final CloseMode closeMode) { private synchronized void closeConnection(final CloseMode closeMode) {
if (this.conn != null) { if (this.conn != null) {
this.log.debug("Closing connection " + closeMode); this.log.debug("Closing connection {}", closeMode);
this.conn.close(closeMode); this.conn.close(closeMode);
this.conn = null; this.conn = null;
} }
@ -215,7 +215,7 @@ private synchronized void closeConnection(final CloseMode closeMode) {
private void checkExpiry() { private void checkExpiry() {
if (this.conn != null && System.currentTimeMillis() >= this.expiry) { if (this.conn != null && System.currentTimeMillis() >= this.expiry) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Connection expired @ " + new Date(this.expiry)); this.log.debug("Connection expired @ {}", new Date(this.expiry));
} }
closeConnection(CloseMode.GRACEFUL); closeConnection(CloseMode.GRACEFUL);
} }
@ -224,7 +224,7 @@ private void checkExpiry() {
synchronized ManagedHttpClientConnection getConnection(final HttpRoute route, final Object state) throws IOException { synchronized ManagedHttpClientConnection getConnection(final HttpRoute route, final Object state) throws IOException {
Asserts.check(!this.closed.get(), "Connection manager has been shut down"); Asserts.check(!this.closed.get(), "Connection manager has been shut down");
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Get connection for route " + route); this.log.debug("Get connection for route {}", route);
} }
Asserts.check(!this.leased, "Connection is still allocated"); Asserts.check(!this.leased, "Connection is still allocated");
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) { if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
@ -255,7 +255,7 @@ public synchronized void release(final ConnectionEndpoint endpoint, final Object
final InternalConnectionEndpoint internalEndpoint = cast(endpoint); final InternalConnectionEndpoint internalEndpoint = cast(endpoint);
final ManagedHttpClientConnection conn = internalEndpoint.detach(); final ManagedHttpClientConnection conn = internalEndpoint.detach();
if (conn != null && this.log.isDebugEnabled()) { if (conn != null && this.log.isDebugEnabled()) {
this.log.debug("Releasing connection " + conn); this.log.debug("Releasing connection {}", conn);
} }
if (this.closed.get()) { if (this.closed.get()) {
return; return;
@ -278,7 +278,7 @@ public synchronized void release(final ConnectionEndpoint endpoint, final Object
conn.passivate(); conn.passivate();
if (TimeValue.isPositive(keepAlive)) { if (TimeValue.isPositive(keepAlive)) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Connection can be kept alive for " + keepAlive); this.log.debug("Connection can be kept alive for {}", keepAlive);
} }
this.expiry = this.updated + keepAlive.toMilliseconds(); this.expiry = this.updated + keepAlive.toMilliseconds();
} else { } else {

View File

@ -142,13 +142,13 @@ public void connect(
final InetSocketAddress remoteAddress = new InetSocketAddress(address, port); final InetSocketAddress remoteAddress = new InetSocketAddress(address, port);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(ConnPoolSupport.getId(conn) + ": connecting to " + remoteAddress); this.log.debug("{}: connecting to {}", ConnPoolSupport.getId(conn), remoteAddress);
} }
try { try {
sock = sf.connectSocket(connectTimeout, sock, host, remoteAddress, localAddress, context); sock = sf.connectSocket(connectTimeout, sock, host, remoteAddress, localAddress, context);
conn.bind(sock); conn.bind(sock);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(ConnPoolSupport.getId(conn) + ": connection established " + conn); this.log.debug("{}: connection established {}", ConnPoolSupport.getId(conn), conn);
} }
return; return;
} catch (final IOException ex) { } catch (final IOException ex) {
@ -157,8 +157,7 @@ public void connect(
} }
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(ConnPoolSupport.getId(conn) + ": connect to " + remoteAddress + " timed out. " + this.log.debug("{}: connect to {} timed out. Connection will be retried using another IP address", ConnPoolSupport.getId(conn), remoteAddress);
"Connection will be retried using another IP address");
} }
} }
} }

View File

@ -122,7 +122,7 @@ public SSLSession getSSLSession() {
public void close() throws IOException { public void close() throws IOException {
if (this.closed.compareAndSet(false, true)) { if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + ": Close connection"); this.log.debug("{}: Close connection", this.id);
} }
super.close(); super.close();
} }
@ -131,7 +131,7 @@ public void close() throws IOException {
@Override @Override
public void setSocketTimeout(final Timeout timeout) { public void setSocketTimeout(final Timeout timeout) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + ": set socket timeout to " + timeout); this.log.debug("{}: set socket timeout to {}", this.id, timeout);
} }
super.setSocketTimeout(timeout); super.setSocketTimeout(timeout);
} }
@ -140,7 +140,7 @@ public void setSocketTimeout(final Timeout timeout) {
public void close(final CloseMode closeMode) { public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) { if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(this.id + ": close connection " + closeMode); this.log.debug("{}: close connection {}", this.id, closeMode);
} }
super.close(closeMode); super.close(closeMode);
} }
@ -155,10 +155,10 @@ public void bind(final Socket socket) throws IOException {
@Override @Override
protected void onResponseReceived(final ClassicHttpResponse response) { protected void onResponseReceived(final ClassicHttpResponse response) {
if (response != null && this.headerLog.isDebugEnabled()) { if (response != null && this.headerLog.isDebugEnabled()) {
this.headerLog.debug(this.id + " << " + new StatusLine(response)); this.headerLog.debug("{} << {}", this.id, new StatusLine(response));
final Header[] headers = response.getHeaders(); final Header[] headers = response.getHeaders();
for (final Header header : headers) { for (final Header header : headers) {
this.headerLog.debug(this.id + " << " + header.toString()); this.headerLog.debug("{} << {}", this.id, header);
} }
} }
} }
@ -166,10 +166,10 @@ protected void onResponseReceived(final ClassicHttpResponse response) {
@Override @Override
protected void onRequestSubmitted(final ClassicHttpRequest request) { protected void onRequestSubmitted(final ClassicHttpRequest request) {
if (request != null && this.headerLog.isDebugEnabled()) { if (request != null && this.headerLog.isDebugEnabled()) {
this.headerLog.debug(this.id + " >> " + new RequestLine(request)); this.headerLog.debug("{} >> {}", this.id, new RequestLine(request));
final Header[] headers = request.getHeaders(); final Header[] headers = request.getHeaders();
for (final Header header : headers) { for (final Header header : headers) {
this.headerLog.debug(this.id + " >> " + header.toString()); this.headerLog.debug("{} >> {}", this.id, header);
} }
} }
} }

View File

@ -85,7 +85,7 @@ protected ClassicHttpResponse createMessage(final CharArrayBuffer buffer) throws
return super.createMessage(buffer); return super.createMessage(buffer);
} catch (final HttpException ex) { } catch (final HttpException ex) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Garbage in response: " + buffer.toString()); this.log.debug("Garbage in response: {}", buffer);
} }
return null; return null;
} }

View File

@ -232,7 +232,7 @@ public void close() {
public void close(final CloseMode closeMode) { public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) { if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Shutdown connection pool " + closeMode); this.log.debug("Shutdown connection pool {}", closeMode);
} }
this.pool.close(closeMode); this.pool.close(closeMode);
this.log.debug("Connection pool shut down"); this.log.debug("Connection pool shut down");
@ -258,8 +258,7 @@ public LeaseRequest lease(
final Object state) { final Object state) {
Args.notNull(route, "HTTP route"); Args.notNull(route, "HTTP route");
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint lease request (" + requestTimeout + ") " + log.debug("{}: endpoint lease request ({}) {}", id, requestTimeout, ConnPoolSupport.formatStats(route, state, pool));
ConnPoolSupport.formatStats(route, state, pool));
} }
final Future<PoolEntry<HttpRoute, ManagedHttpClientConnection>> leaseFuture = this.pool.lease(route, state, requestTimeout, null); final Future<PoolEntry<HttpRoute, ManagedHttpClientConnection>> leaseFuture = this.pool.lease(route, state, requestTimeout, null);
return new LeaseRequest() { return new LeaseRequest() {
@ -284,7 +283,7 @@ public synchronized ConnectionEndpoint get(
throw ex; throw ex;
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint leased " + ConnPoolSupport.formatStats(route, state, pool)); log.debug("{}: endpoint leased {}", id, ConnPoolSupport.formatStats(route, state, pool));
} }
try { try {
if (TimeValue.isNonNegative(validateAfterInactivity)) { if (TimeValue.isNonNegative(validateAfterInactivity)) {
@ -299,7 +298,7 @@ public synchronized ConnectionEndpoint get(
} }
if (stale) { if (stale) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": connection " + ConnPoolSupport.getId(conn) + " is stale"); log.debug("{}: connection {} is stale", id, ConnPoolSupport.getId(conn));
} }
poolEntry.discardConnection(CloseMode.IMMEDIATE); poolEntry.discardConnection(CloseMode.IMMEDIATE);
} }
@ -313,19 +312,19 @@ public synchronized ConnectionEndpoint get(
} }
if (leaseFuture.isCancelled()) { if (leaseFuture.isCancelled()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint lease cancelled"); log.debug("{}: endpoint lease cancelled", id);
} }
pool.release(poolEntry, false); pool.release(poolEntry, false);
} else { } else {
this.endpoint = new InternalConnectionEndpoint(poolEntry); this.endpoint = new InternalConnectionEndpoint(poolEntry);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquired " + ConnPoolSupport.getId(endpoint)); log.debug("{}: acquired {}", id, ConnPoolSupport.getId(endpoint));
} }
} }
return this.endpoint; return this.endpoint;
} catch (final Exception ex) { } catch (final Exception ex) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint lease failed"); log.debug("{}: endpoint lease failed", id);
} }
pool.release(poolEntry, false); pool.release(poolEntry, false);
throw new ExecutionException(ex.getMessage(), ex); throw new ExecutionException(ex.getMessage(), ex);
@ -349,7 +348,7 @@ public void release(final ConnectionEndpoint endpoint, final Object state, final
return; return;
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": releasing endpoint"); log.debug("{}: releasing endpoint", ConnPoolSupport.getId(endpoint));
} }
final ManagedHttpClientConnection conn = entry.getConnection(); final ManagedHttpClientConnection conn = entry.getConnection();
if (conn != null && keepAlive == null) { if (conn != null && keepAlive == null) {
@ -368,12 +367,11 @@ public void release(final ConnectionEndpoint endpoint, final Object state, final
} else { } else {
s = "indefinitely"; s = "indefinitely";
} }
log.debug(ConnPoolSupport.getId(endpoint) + ": connection " + ConnPoolSupport.getId(conn) + log.debug("{}: connection {} can be kept alive {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.getId(conn), s);
" can be kept alive " + s);
} }
} else { } else {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug(ConnPoolSupport.getId(endpoint) + ": connection is not kept alive"); this.log.debug("{}: connection is not kept alive", ConnPoolSupport.getId(endpoint));
} }
} }
} catch (final RuntimeException ex) { } catch (final RuntimeException ex) {
@ -382,8 +380,7 @@ public void release(final ConnectionEndpoint endpoint, final Object state, final
} finally { } finally {
this.pool.release(entry, reusable); this.pool.release(entry, reusable);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connection released " + log.debug("{}: connection released {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.formatStats(entry.getRoute(), entry.getState(), pool));
ConnPoolSupport.formatStats(entry.getRoute(), entry.getState(), pool));
} }
} }
} }
@ -407,7 +404,7 @@ public void connect(final ConnectionEndpoint endpoint, final TimeValue connectTi
host = route.getTargetHost(); host = route.getTargetHost();
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connecting endpoint to " + host + " (" + connectTimeout + ")"); log.debug("{}: connecting endpoint to {} ({})", ConnPoolSupport.getId(endpoint), host, connectTimeout);
} }
final ManagedHttpClientConnection conn = poolEntry.getConnection(); final ManagedHttpClientConnection conn = poolEntry.getConnection();
this.connectionOperator.connect( this.connectionOperator.connect(
@ -418,7 +415,7 @@ public void connect(final ConnectionEndpoint endpoint, final TimeValue connectTi
defaultSocketConfig != null ? this.defaultSocketConfig : SocketConfig.DEFAULT, defaultSocketConfig != null ? this.defaultSocketConfig : SocketConfig.DEFAULT,
context); context);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connected " + ConnPoolSupport.getId(conn)); log.debug("{}: connected {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.getId(conn));
} }
} }
@ -435,7 +432,7 @@ public void upgrade(final ConnectionEndpoint endpoint, final HttpContext context
public void closeIdle(final TimeValue idleTime) { public void closeIdle(final TimeValue idleTime) {
Args.notNull(idleTime, "Idle time"); Args.notNull(idleTime, "Idle time");
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Closing connections idle longer than " + idleTime); this.log.debug("Closing connections idle longer than {}", idleTime);
} }
this.pool.closeIdle(idleTime); this.pool.closeIdle(idleTime);
} }
@ -595,7 +592,7 @@ public ClassicHttpResponse execute(
Args.notNull(requestExecutor, "Request executor"); Args.notNull(requestExecutor, "Request executor");
final ManagedHttpClientConnection connection = getValidatedPoolEntry().getConnection(); final ManagedHttpClientConnection connection = getValidatedPoolEntry().getConnection();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": executing exchange " + exchangeId + " over " + ConnPoolSupport.getId(connection)); log.debug("{}: executing exchange {} over {}", id, exchangeId, ConnPoolSupport.getId(connection));
} }
return requestExecutor.execute(request, connection, context); return requestExecutor.execute(request, connection, context);
} }

View File

@ -78,7 +78,7 @@ public String getId() {
public void close(final CloseMode closeMode) { public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) { if (this.closed.compareAndSet(false, true)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(getId() + ": Shutdown connection " + closeMode); log.debug("{}: Shutdown connection {}", getId(), closeMode);
} }
ioSession.close(closeMode); ioSession.close(closeMode);
} }
@ -88,7 +88,7 @@ public void close(final CloseMode closeMode) {
public void close() throws IOException { public void close() throws IOException {
if (this.closed.compareAndSet(false, true)) { if (this.closed.compareAndSet(false, true)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(getId() + ": Close connection"); log.debug("{}: Close connection", getId());
} }
ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE); ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE);
} }
@ -146,7 +146,7 @@ public void startTls(
final SSLSessionVerifier verifier, final SSLSessionVerifier verifier,
final Timeout handshakeTimeout) throws UnsupportedOperationException { final Timeout handshakeTimeout) throws UnsupportedOperationException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(getId() + ": start TLS"); log.debug("{}: start TLS", getId());
} }
if (ioSession instanceof TransportSecurityLayer) { if (ioSession instanceof TransportSecurityLayer) {
((TransportSecurityLayer) ioSession).startTls(sslContext, endpoint, sslBufferMode, initializer, verifier, ((TransportSecurityLayer) ioSession).startTls(sslContext, endpoint, sslBufferMode, initializer, verifier,
@ -170,7 +170,7 @@ public SSLSession getSSLSession() {
@Override @Override
public void submitCommand(final Command command, final Command.Priority priority) { public void submitCommand(final Command command, final Command.Priority priority) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(getId() + ": " + command.getClass().getSimpleName() + " with " + priority + " priority"); log.debug("{}: {} with {} priority", getId(), command.getClass().getSimpleName(), priority);
} }
ioSession.enqueue(command, Command.Priority.IMMEDIATE); ioSession.enqueue(command, Command.Priority.IMMEDIATE);
} }

View File

@ -68,13 +68,13 @@ public Future<IOSession> connect(
if (remoteAddress != null) { if (remoteAddress != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": connecting " + localAddress + " to " + remoteAddress + " (" + connectTimeout + ")"); log.debug("{}: connecting {} to {} ({})", remoteEndpoint, localAddress, remoteAddress, connectTimeout);
} }
return connectionInitiator.connect(remoteEndpoint, remoteAddress, localAddress, connectTimeout, attachment, callback); return connectionInitiator.connect(remoteEndpoint, remoteAddress, localAddress, connectTimeout, attachment, callback);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": resolving remote address"); log.debug("{}: resolving remote address", remoteEndpoint);
} }
final ComplexFuture<IOSession> future = new ComplexFuture<>(callback); final ComplexFuture<IOSession> future = new ComplexFuture<>(callback);
@ -87,7 +87,7 @@ public Future<IOSession> connect(
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": resolved to " + Arrays.asList(remoteAddresses)); log.debug("{}: resolved to {}", remoteEndpoint, Arrays.asList(remoteAddresses));
} }
final Runnable runnable = new Runnable() { final Runnable runnable = new Runnable() {
@ -99,7 +99,7 @@ void executeNext() {
final InetSocketAddress remoteAddress = new InetSocketAddress(remoteAddresses[index], remoteEndpoint.getPort()); final InetSocketAddress remoteAddress = new InetSocketAddress(remoteAddresses[index], remoteEndpoint.getPort());
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": connecting " + localAddress + " to " + remoteAddress + " (" + connectTimeout + ")"); log.debug("{}: connecting {} to {} ({})", remoteEndpoint, localAddress, remoteAddress, connectTimeout);
} }
final Future<IOSession> sessionFuture = connectionInitiator.connect( final Future<IOSession> sessionFuture = connectionInitiator.connect(
@ -114,8 +114,7 @@ void executeNext() {
public void completed(final IOSession session) { public void completed(final IOSession session) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": connected " + session.getId() + " " + log.debug("{}: connected {} {}->{}", remoteEndpoint, session.getId(), session.getLocalAddress(), session.getRemoteAddress());
session.getLocalAddress() + "->" + session.getRemoteAddress());
} }
} }
future.completed(session); future.completed(session);
@ -125,8 +124,7 @@ public void completed(final IOSession session) {
public void failed(final Exception cause) { public void failed(final Exception cause) {
if (attempt.get() >= remoteAddresses.length) { if (attempt.get() >= remoteAddresses.length) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": connection to " + remoteAddress + " failed " + log.debug("{}: connection to {} failed ({}); terminating operation", remoteEndpoint, remoteAddress, cause.getClass());
"(" + cause.getClass() + "); terminating operation");
} }
if (cause instanceof IOException) { if (cause instanceof IOException) {
future.failed(ConnectExceptionSupport.enhance((IOException) cause, remoteEndpoint, remoteAddresses)); future.failed(ConnectExceptionSupport.enhance((IOException) cause, remoteEndpoint, remoteAddresses));
@ -135,8 +133,7 @@ public void failed(final Exception cause) {
} }
} else { } else {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(remoteEndpoint + ": connection to " + remoteAddress + " failed " + log.debug("{}: connection to {} failed ({}); retrying connection to the next address", remoteEndpoint, remoteAddress, cause.getClass());
"(" + cause.getClass() + "); retrying connection to the next address");
} }
executeNext(); executeNext();
} }

View File

@ -197,7 +197,7 @@ public void close() {
public void close(final CloseMode closeMode) { public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) { if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Shutdown connection pool " + closeMode); this.log.debug("Shutdown connection pool {}", closeMode);
} }
this.pool.close(closeMode); this.pool.close(closeMode);
this.log.debug("Connection pool shut down"); this.log.debug("Connection pool shut down");
@ -219,8 +219,7 @@ public Future<AsyncConnectionEndpoint> lease(
final Timeout requestTimeout, final Timeout requestTimeout,
final FutureCallback<AsyncConnectionEndpoint> callback) { final FutureCallback<AsyncConnectionEndpoint> callback) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint lease request (" + requestTimeout + ") " + log.debug("{}: endpoint lease request ({}) {}", id, requestTimeout, ConnPoolSupport.formatStats(route, state, pool));
ConnPoolSupport.formatStats(route, state, pool));
} }
final ComplexFuture<AsyncConnectionEndpoint> resultFuture = new ComplexFuture<>(callback); final ComplexFuture<AsyncConnectionEndpoint> resultFuture = new ComplexFuture<>(callback);
final Future<PoolEntry<HttpRoute, ManagedAsyncClientConnection>> leaseFuture = pool.lease( final Future<PoolEntry<HttpRoute, ManagedAsyncClientConnection>> leaseFuture = pool.lease(
@ -232,11 +231,11 @@ void leaseCompleted(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poo
connection.activate(); connection.activate();
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint leased " + ConnPoolSupport.formatStats(route, state, pool)); log.debug("{}: endpoint leased {}", id, ConnPoolSupport.formatStats(route, state, pool));
} }
final AsyncConnectionEndpoint endpoint = new InternalConnectionEndpoint(poolEntry); final AsyncConnectionEndpoint endpoint = new InternalConnectionEndpoint(poolEntry);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": acquired " + ConnPoolSupport.getId(endpoint)); log.debug("{}: acquired {}", id, ConnPoolSupport.getId(endpoint));
} }
resultFuture.completed(endpoint); resultFuture.completed(endpoint);
} }
@ -255,7 +254,7 @@ public void completed(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> p
public void execute(final Boolean result) { public void execute(final Boolean result) {
if (result == Boolean.FALSE) { if (result == Boolean.FALSE) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": connection " + ConnPoolSupport.getId(connection) + " is stale"); log.debug("{}: connection {} is stale", id, ConnPoolSupport.getId(connection));
} }
poolEntry.discardConnection(CloseMode.IMMEDIATE); poolEntry.discardConnection(CloseMode.IMMEDIATE);
} }
@ -266,7 +265,7 @@ public void execute(final Boolean result) {
} else { } else {
if (!connection.isOpen()) { if (!connection.isOpen()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": connection " + ConnPoolSupport.getId(connection) + " is closed"); log.debug("{}: connection {} is closed", id, ConnPoolSupport.getId(connection));
} }
poolEntry.discardConnection(CloseMode.IMMEDIATE); poolEntry.discardConnection(CloseMode.IMMEDIATE);
} }
@ -280,7 +279,7 @@ public void execute(final Boolean result) {
@Override @Override
public void failed(final Exception ex) { public void failed(final Exception ex) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint lease failed"); log.debug("{}: endpoint lease failed", id);
} }
resultFuture.failed(ex); resultFuture.failed(ex);
} }
@ -288,7 +287,7 @@ public void failed(final Exception ex) {
@Override @Override
public void cancelled() { public void cancelled() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": endpoint lease cancelled"); log.debug("{}: endpoint lease cancelled", id);
} }
resultFuture.cancel(); resultFuture.cancel();
} }
@ -308,7 +307,7 @@ public void release(final AsyncConnectionEndpoint endpoint, final Object state,
return; return;
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": releasing endpoint"); log.debug("{}: releasing endpoint", ConnPoolSupport.getId(endpoint));
} }
final ManagedAsyncClientConnection connection = entry.getConnection(); final ManagedAsyncClientConnection connection = entry.getConnection();
boolean reusable = connection != null && connection.isOpen(); boolean reusable = connection != null && connection.isOpen();
@ -324,8 +323,7 @@ public void release(final AsyncConnectionEndpoint endpoint, final Object state,
} else { } else {
s = "indefinitely"; s = "indefinitely";
} }
log.debug(ConnPoolSupport.getId(endpoint) + ": connection " + ConnPoolSupport.getId(connection) + log.debug("{}: connection {} can be kept alive {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.getId(connection), s);
" can be kept alive " + s);
} }
} }
} catch (final RuntimeException ex) { } catch (final RuntimeException ex) {
@ -334,8 +332,7 @@ public void release(final AsyncConnectionEndpoint endpoint, final Object state,
} finally { } finally {
pool.release(entry, reusable); pool.release(entry, reusable);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connection released " + log.debug("{}: connection released {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.formatStats(entry.getRoute(), entry.getState(), pool));
ConnPoolSupport.formatStats(entry.getRoute(), entry.getState(), pool));
} }
} }
} }
@ -367,7 +364,7 @@ public Future<AsyncConnectionEndpoint> connect(
} }
final InetSocketAddress localAddress = route.getLocalSocketAddress(); final InetSocketAddress localAddress = route.getLocalSocketAddress();
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connecting endpoint to " + host + " (" + connectTimeout + ")"); log.debug("{}: connecting endpoint to {} ({})", ConnPoolSupport.getId(endpoint), host, connectTimeout);
} }
final Future<ManagedAsyncClientConnection> connectFuture = connectionOperator.connect( final Future<ManagedAsyncClientConnection> connectFuture = connectionOperator.connect(
connectionInitiator, host, localAddress, connectTimeout, attachment, new FutureCallback<ManagedAsyncClientConnection>() { connectionInitiator, host, localAddress, connectTimeout, attachment, new FutureCallback<ManagedAsyncClientConnection>() {
@ -376,7 +373,7 @@ public Future<AsyncConnectionEndpoint> connect(
public void completed(final ManagedAsyncClientConnection connection) { public void completed(final ManagedAsyncClientConnection connection) {
try { try {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": connected " + ConnPoolSupport.getId(connection)); log.debug("{}: connected {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.getId(connection));
} }
poolEntry.assignConnection(connection); poolEntry.assignConnection(connection);
resultFuture.completed(internalEndpoint); resultFuture.completed(internalEndpoint);
@ -412,7 +409,7 @@ public void upgrade(
final ManagedAsyncClientConnection connection = poolEntry.getConnection(); final ManagedAsyncClientConnection connection = poolEntry.getConnection();
connectionOperator.upgrade(poolEntry.getConnection(), route.getTargetHost(), attachment); connectionOperator.upgrade(poolEntry.getConnection(), route.getTargetHost(), attachment);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(internalEndpoint) + ": upgraded " + ConnPoolSupport.getId(connection)); log.debug("{}: upgraded {}", ConnPoolSupport.getId(internalEndpoint), ConnPoolSupport.getId(connection));
} }
} }
@ -527,7 +524,7 @@ public void close(final CloseMode closeMode) {
final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poolEntry = poolEntryRef.get(); final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poolEntry = poolEntryRef.get();
if (poolEntry != null) { if (poolEntry != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": close " + closeMode); log.debug("{}: close {}", id, closeMode);
} }
poolEntry.discardConnection(closeMode); poolEntry.discardConnection(closeMode);
} }
@ -563,7 +560,7 @@ public void execute(
final HttpContext context) { final HttpContext context) {
final ManagedAsyncClientConnection connection = getValidatedPoolEntry().getConnection(); final ManagedAsyncClientConnection connection = getValidatedPoolEntry().getConnection();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(id + ": executing exchange " + exchangeId + " over " + ConnPoolSupport.getId(connection)); log.debug("{}: executing exchange {} over {}", id, exchangeId, ConnPoolSupport.getId(connection));
} }
connection.submitCommand( connection.submitCommand(
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, context), new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, context),

View File

@ -111,7 +111,7 @@ public void process(final HttpRequest request, final EntityDetails entity, final
cookieSpecName = StandardCookieSpec.STRICT; cookieSpecName = StandardCookieSpec.STRICT;
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Cookie spec selected: " + cookieSpecName); this.log.debug("Cookie spec selected: {}", cookieSpecName);
} }
final URIAuthority authority = request.getAuthority(); final URIAuthority authority = request.getAuthority();
@ -133,7 +133,7 @@ public void process(final HttpRequest request, final EntityDetails entity, final
final CookieSpecFactory factory = registry.lookup(cookieSpecName); final CookieSpecFactory factory = registry.lookup(cookieSpecName);
if (factory == null) { if (factory == null) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Unsupported cookie spec: " + cookieSpecName); this.log.debug("Unsupported cookie spec: {}", cookieSpecName);
} }
return; return;
@ -149,13 +149,13 @@ public void process(final HttpRequest request, final EntityDetails entity, final
if (!cookie.isExpired(now)) { if (!cookie.isExpired(now)) {
if (cookieSpec.match(cookie, cookieOrigin)) { if (cookieSpec.match(cookie, cookieOrigin)) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Cookie " + cookie + " match " + cookieOrigin); this.log.debug("Cookie {} match {}", cookie, cookieOrigin);
} }
matchedCookies.add(cookie); matchedCookies.add(cookie);
} }
} else { } else {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Cookie " + cookie + " expired"); this.log.debug("Cookie {} expired", cookie);
} }
expired = true; expired = true;
} }

View File

@ -104,7 +104,7 @@ public void process(final HttpRequest request, final EntityDetails entity, final
final AuthScheme authScheme = authCache.get(target); final AuthScheme authScheme = authCache.get(target);
if (authScheme != null) { if (authScheme != null) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Re-using cached '" + authScheme.getName() + "' auth scheme for " + target); this.log.debug("Re-using cached '{}' auth scheme for {}", authScheme.getName(), target);
} }
targetAuthExchange.select(authScheme); targetAuthExchange.select(authScheme);
} }
@ -117,7 +117,7 @@ public void process(final HttpRequest request, final EntityDetails entity, final
final AuthScheme authScheme = authCache.get(proxy); final AuthScheme authScheme = authCache.get(proxy);
if (authScheme != null) { if (authScheme != null) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Re-using cached '" + authScheme.getName() + "' auth scheme for " + proxy); this.log.debug("Re-using cached '{}' auth scheme for {}", authScheme.getName(), proxy);
} }
proxyAuthExchange.select(authScheme); proxyAuthExchange.select(authScheme);
} }

View File

@ -108,19 +108,17 @@ private void processCookies(
cookieStore.addCookie(cookie); cookieStore.addCookie(cookie);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Cookie accepted [" + formatCooke(cookie) + "]"); this.log.debug("Cookie accepted [{}]", formatCooke(cookie));
} }
} catch (final MalformedCookieException ex) { } catch (final MalformedCookieException ex) {
if (this.log.isWarnEnabled()) { if (this.log.isWarnEnabled()) {
this.log.warn("Cookie rejected [" + formatCooke(cookie) + "] " this.log.warn("Cookie rejected [{}] {}", formatCooke(cookie), ex.getMessage());
+ ex.getMessage());
} }
} }
} }
} catch (final MalformedCookieException ex) { } catch (final MalformedCookieException ex) {
if (this.log.isWarnEnabled()) { if (this.log.isWarnEnabled()) {
this.log.warn("Invalid cookie header: \"" this.log.warn("Invalid cookie header: \"{}\". {}", header, ex.getMessage());
+ header + "\". " + ex.getMessage());
} }
} }
} }

View File

@ -122,8 +122,8 @@ public void initialize(final NamedEndpoint endpoint, final SSLEngine sslEngine)
initializeEngine(sslEngine); initializeEngine(sslEngine);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Enabled protocols: " + Arrays.asList(sslEngine.getEnabledProtocols())); log.debug("Enabled protocols: {}", Arrays.asList(sslEngine.getEnabledProtocols()));
log.debug("Enabled cipher suites:" + Arrays.asList(sslEngine.getEnabledCipherSuites())); log.debug("Enabled cipher suites:{}", Arrays.asList(sslEngine.getEnabledCipherSuites()));
} }
} }

View File

@ -211,7 +211,7 @@ public Socket connectSocket(
sock.setSoTimeout(connectTimeout.toMillisecondsIntBound()); sock.setSoTimeout(connectTimeout.toMillisecondsIntBound());
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Connecting socket to " + remoteAddress + " with timeout " + connectTimeout); this.log.debug("Connecting socket to {} with timeout {}", remoteAddress, connectTimeout);
} }
// Run this under a doPrivileged to support lib users that run under a SecurityManager this allows granting connect permissions // Run this under a doPrivileged to support lib users that run under a SecurityManager this allows granting connect permissions
// only to this library // only to this library
@ -267,8 +267,8 @@ public Socket createLayeredSocket(
} }
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Enabled protocols: " + Arrays.asList(sslsock.getEnabledProtocols())); this.log.debug("Enabled protocols: {}", Arrays.asList(sslsock.getEnabledProtocols()));
this.log.debug("Enabled cipher suites:" + Arrays.asList(sslsock.getEnabledCipherSuites())); this.log.debug("Enabled cipher suites:{}", Arrays.asList(sslsock.getEnabledCipherSuites()));
} }
prepareSocket(sslsock); prepareSocket(sslsock);

View File

@ -56,8 +56,8 @@ void verifySession(
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Secure session established"); log.debug("Secure session established");
log.debug(" negotiated protocol: " + sslsession.getProtocol()); log.debug(" negotiated protocol: {}", sslsession.getProtocol());
log.debug(" negotiated cipher suite: " + sslsession.getCipherSuite()); log.debug(" negotiated cipher suite: {}", sslsession.getCipherSuite());
try { try {
@ -67,7 +67,7 @@ void verifySession(
final X509Certificate x509 = (X509Certificate) cert; final X509Certificate x509 = (X509Certificate) cert;
final X500Principal peer = x509.getSubjectX500Principal(); final X500Principal peer = x509.getSubjectX500Principal();
log.debug(" peer principal: " + peer.toString()); log.debug(" peer principal: {}", peer);
final Collection<List<?>> altNames1 = x509.getSubjectAlternativeNames(); final Collection<List<?>> altNames1 = x509.getSubjectAlternativeNames();
if (altNames1 != null) { if (altNames1 != null) {
final List<String> altNames = new ArrayList<>(); final List<String> altNames = new ArrayList<>();
@ -76,11 +76,11 @@ void verifySession(
altNames.add((String) aC.get(1)); altNames.add((String) aC.get(1));
} }
} }
log.debug(" peer alternative names: " + altNames); log.debug(" peer alternative names: {}", altNames);
} }
final X500Principal issuer = x509.getIssuerX500Principal(); final X500Principal issuer = x509.getIssuerX500Principal();
log.debug(" issuer principal: " + issuer.toString()); log.debug(" issuer principal: {}", issuer);
final Collection<List<?>> altNames2 = x509.getIssuerAlternativeNames(); final Collection<List<?>> altNames2 = x509.getIssuerAlternativeNames();
if (altNames2 != null) { if (altNames2 != null) {
final List<String> altNames = new ArrayList<>(); final List<String> altNames = new ArrayList<>();
@ -89,7 +89,7 @@ void verifySession(
altNames.add((String) aC.get(1)); altNames.add((String) aC.get(1));
} }
} }
log.debug(" issuer alternative names: " + altNames); log.debug(" issuer alternative names: {}", altNames);
} }
} }
} catch (final Exception ignore) { } catch (final Exception ignore) {

View File

@ -64,7 +64,7 @@ public static void main(final String[] args) throws Exception {
System.out.println("None"); System.out.println("None");
} else { } else {
for (int i = 0; i < cookies.size(); i++) { for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i).toString()); System.out.println("- " + cookies.get(i));
} }
} }
} }
@ -86,7 +86,7 @@ public static void main(final String[] args) throws Exception {
System.out.println("None"); System.out.println("None");
} else { } else {
for (int i = 0; i < cookies.size(); i++) { for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i).toString()); System.out.println("- " + cookies.get(i));
} }
} }
} }

View File

@ -87,7 +87,7 @@ public static void main(final String[] args) throws Exception {
System.out.println(streamingResponse.getHead()); System.out.println(streamingResponse.getHead());
for (final Header header : streamingResponse.getHead().getHeaders()) { for (final Header header : streamingResponse.getHead().getHeaders()) {
System.out.println(header.toString()); System.out.println(header);
} }
System.out.println(); System.out.println();
@ -104,7 +104,7 @@ public String apply(final ByteBuffer byteBuffer) throws Exception {
.forEach(new Consumer<Notification<String>>() { .forEach(new Consumer<Notification<String>>() {
@Override @Override
public void accept(final Notification<String> byteBufferNotification) throws Exception { public void accept(final Notification<String> byteBufferNotification) throws Exception {
System.out.println(byteBufferNotification.toString()); System.out.println(byteBufferNotification);
} }
}); });

View File

@ -592,7 +592,7 @@ public final static void checkCTLS(final RouteTracker rt,
public final static boolean checkVia(final RouteTracker rt, final HttpRoute r, public final static boolean checkVia(final RouteTracker rt, final HttpRoute r,
final HttpRouteDirector rd, final int steps) { final HttpRouteDirector rd, final int steps) {
final String msg = r.toString() + " @ " + rt.toString(); final String msg = r + " @ " + rt;
boolean complete = false; boolean complete = false;
int n = steps; int n = steps;