You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/04/22 08:32:30 UTC

[incubator-servicecomb-java-chassis] 03/09: [SCB-486] optimize connection log.

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit 68b4bbae087d5f40abe2add54bf113242ee2d306
Author: wujimin <wu...@huawei.com>
AuthorDate: Sat Apr 21 21:33:14 2018 +0800

    [SCB-486] optimize connection log.
---
 .../rest/client/http/RestClientInvocation.java        | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
index 58789a6..df56c98 100644
--- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
+++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
@@ -90,10 +90,25 @@ public class RestClientInvocation {
     }
 
     clientRequest.exceptionHandler(e -> {
-      LOGGER.error(e.toString());
+      LOGGER.error("Failed to send request to {}.", ipPort.getSocketAddress(), e);
       asyncResp.fail(invocation.getInvocationType(), e);
     });
-
+    clientRequest.connectionHandler(connection -> {
+      LOGGER.info("http connection connected, local:{}, remote:{}.",
+          connection.localAddress(),
+          connection.remoteAddress());
+      connection.closeHandler(v -> {
+        LOGGER.info("http connection closed, local:{}, remote:{}.",
+            connection.localAddress(),
+            connection.remoteAddress());
+      });
+      connection.exceptionHandler(e -> {
+        LOGGER.info("http connection exception, local:{}, remote:{}.",
+            connection.localAddress(),
+            connection.remoteAddress(),
+            e);
+      });
+    });
     // 从业务线程转移到网络线程中去发送
     httpClientWithContext.runOnContext(httpClient -> {
       this.setCseContext();

-- 
To stop receiving notification emails like this one, please contact
liubao@apache.org.