hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1781737 - in /httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client: AbstractClientExchangeHandler.java MainClientExec.java
Date Sun, 05 Feb 2017 12:25:39 GMT
Author: olegk
Date: Sun Feb  5 12:25:39 2017
New Revision: 1781737

URL: http://svn.apache.org/viewvc?rev=1781737&view=rev
Log:
Added missing exchange id to debug logs

Modified:
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java?rev=1781737&r1=1781736&r2=1781737&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
(original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
Sun Feb  5 12:25:39 2017
@@ -162,11 +162,15 @@ abstract class AbstractClientExchangeHan
             final boolean routeComplete = this.connmgr.isRouteComplete(managedConn);
             this.routeEstablished.set(routeComplete);
             if (!routeComplete) {
-                this.log.debug("Start connection routing");
+                if (this.log.isDebugEnabled()) {
+                    this.log.debug("[exchange: " + this.id + "] Start connection routing");
+                }
                 final HttpRoute route = this.routeRef.get();
                 this.routeTrackerRef.set(new RouteTracker(route));
             } else {
-                this.log.debug("Connection route already established");
+                if (this.log.isDebugEnabled()) {
+                    this.log.debug("[exchange: " + this.id + "] Connection route already
established");
+                }
             }
         }
     }
@@ -216,6 +220,9 @@ abstract class AbstractClientExchangeHan
         Asserts.check(managedConn != null, "Inconsistent state: managed connection is null");
         final HttpRoute route = this.routeRef.get();
         Asserts.check(route != null, "Inconsistent state: HTTP route is null");
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("[exchange: " + this.id + "] route completed");
+        }
         this.connmgr.routeComplete(managedConn, route, this.localContext);
         this.routeEstablished.set(true);
         this.routeTrackerRef.set(null);
@@ -244,7 +251,7 @@ abstract class AbstractClientExchangeHan
                     }
                 } catch (final IOException ex) {
                     if (this.log.isDebugEnabled()) {
-                        this.log.debug(ex.getMessage(), ex);
+                        this.log.debug("[exchange: " + this.id + "] " + ex.getMessage(),
ex);
                     }
                 } finally {
                     this.connmgr.releaseConnection(localConn, null, 0, TimeUnit.MILLISECONDS);
@@ -263,7 +270,7 @@ abstract class AbstractClientExchangeHan
                 }
             } catch (final IOException ex) {
                 if (this.log.isDebugEnabled()) {
-                    this.log.debug(ex.getMessage(), ex);
+                    this.log.debug("[exchange: " + this.id + "] " + ex.getMessage(), ex);
                 }
             } finally {
                 this.connmgr.releaseConnection(localConn, null, 0, TimeUnit.MILLISECONDS);

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java?rev=1781737&r1=1781736&r2=1781737&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
(original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
Sun Feb  5 12:25:39 2017
@@ -185,7 +185,7 @@ class MainClientExec implements Internal
                             "planned = " + route + "; current = " + fact);
                 case HttpRouteDirector.COMPLETE:
                     handler.onRouteComplete();
-                    this.log.debug("Connection route established");
+                    this.log.debug("[exchange: " + state.getId() + "] Connection route established");
                     break;
                 default:
                     throw new IllegalStateException("Unknown step indicator "
@@ -219,14 +219,14 @@ class MainClientExec implements Internal
             if (!currentRequest.containsHeader(AUTH.WWW_AUTH_RESP)) {
                 final AuthState targetAuthState = localContext.getTargetAuthState();
                 if (this.log.isDebugEnabled()) {
-                    this.log.debug("Target auth state: " + targetAuthState.getState());
+                    this.log.debug("[exchange: " + state.getId() + "] Target auth state:
" + targetAuthState.getState());
                 }
                 this.authenticator.generateAuthResponse(currentRequest, targetAuthState,
localContext);
             }
             if (!currentRequest.containsHeader(AUTH.PROXY_AUTH_RESP) && !route.isTunnelled())
{
                 final AuthState proxyAuthState = localContext.getProxyAuthState();
                 if (this.log.isDebugEnabled()) {
-                    this.log.debug("Proxy auth state: " + proxyAuthState.getState());
+                    this.log.debug("[exchange: " + state.getId() + "] Proxy auth state: "
+ proxyAuthState.getState());
                 }
                 this.authenticator.generateAuthResponse(currentRequest, proxyAuthState, localContext);
             }
@@ -234,7 +234,7 @@ class MainClientExec implements Internal
             if (!currentRequest.containsHeader(AUTH.PROXY_AUTH_RESP)) {
                 final AuthState proxyAuthState = localContext.getProxyAuthState();
                 if (this.log.isDebugEnabled()) {
-                    this.log.debug("Proxy auth state: " + proxyAuthState.getState());
+                    this.log.debug("[exchange: " + state.getId() + "] Proxy auth state: "
+ proxyAuthState.getState());
                 }
                 this.authenticator.generateAuthResponse(currentRequest, proxyAuthState, localContext);
             }
@@ -484,8 +484,8 @@ class MainClientExec implements Internal
                 uri = URI.create(uriString);
             } catch (final IllegalArgumentException ex) {
                 if (this.log.isDebugEnabled()) {
-                    this.log.debug("Unable to parse '" + uriString + "' as a valid URI; "
+
-                        "request URI and Host header may be inconsistent", ex);
+                    this.log.debug("[exchange: " + state.getId() + "] Unable to parse '"
+ uriString +
+                            "' as a valid URI; request URI and Host header may be inconsistent",
ex);
                 }
             }
 



Mime
View raw message