From c183e0d4026770a68bedce02507446431cdf6265 Mon Sep 17 00:00:00 2001 From: Jaskey Date: Mon, 17 Apr 2017 19:28:26 +0800 Subject: [PATCH] [ROCKETMQ-172]log improvement for rocketmq client closes apache/incubator-rocketmq#90 --- .../org/apache/rocketmq/client/impl/MQClientAPIImpl.java | 6 +++--- .../rocketmq/client/impl/factory/MQClientInstance.java | 2 +- .../apache/rocketmq/remoting/netty/NettyRemotingClient.java | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java index 6119e248..ff25334f 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java @@ -593,12 +593,12 @@ public class MQClientAPIImpl { } } else { if (!responseFuture.isSendRequestOK()) { - pullCallback.onException(new MQClientException("send request failed", responseFuture.getCause())); + pullCallback.onException(new MQClientException("send request failed to " + addr + ". Request: " + request, responseFuture.getCause())); } else if (responseFuture.isTimeout()) { - pullCallback.onException(new MQClientException("wait response timeout " + responseFuture.getTimeoutMillis() + "ms", + pullCallback.onException(new MQClientException("wait response from " + addr + " timeout :" + responseFuture.getTimeoutMillis() + "ms" + ". Request: " + request, responseFuture.getCause())); } else { - pullCallback.onException(new MQClientException("unknow reseaon", responseFuture.getCause())); + pullCallback.onException(new MQClientException("unknown reason. addr: " + addr + ", timeoutMillis: " + timeoutMillis + ". Request: " + request, responseFuture.getCause())); } } } diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java index 11266c4d..d7e02fe3 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java @@ -596,7 +596,7 @@ public class MQClientInstance { } } } - log.info("topicRouteTable.put TopicRouteData[{}]", cloneTopicRouteData); + log.info("topicRouteTable.put. Topic = {}, TopicRouteData[{}]", topic, cloneTopicRouteData); this.topicRouteTable.put(topic, cloneTopicRouteData); return true; } diff --git a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java index 85f9244d..26088aa5 100644 --- a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java +++ b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java @@ -321,6 +321,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti if (update) { Collections.shuffle(addrs); + log.info("name server address updated. NEW : {} , OLD: {}",addrs,old); this.namesrvAddrList.set(addrs); } } @@ -398,6 +399,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti String newAddr = addrList.get(index); this.namesrvAddrChoosed.set(newAddr); + log.info("new name server is chosen. OLD: {} , NEW: {}. namesrvIndex = {}", addr, newAddr, namesrvIndex); Channel channelNew = this.createChannel(newAddr); if (channelNew != null) return channelNew; -- GitLab