Permalink
Browse files

more readable logs

  • Loading branch information...
1 parent 0eefbdb commit 9da8aa49a2c6d2df3ff854b643af627ba177aea5 @adyliu committed May 26, 2012
@@ -97,6 +97,7 @@ protected T makeNext0() throws InterruptedException {
}
}
if (currentDataChunk == ZookeeperConsumerConnector.SHUTDOWN_COMMAND) {
+ logger.warn("Now closing the message stream");
queue.offer(currentDataChunk);
return allDone();
} else {
@@ -17,6 +17,8 @@
package com.sohu.jafka.consumer;
+import static java.lang.String.format;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -88,7 +90,7 @@ public void shutdown() throws InterruptedException {
public void run() {
StringBuilder buf = new StringBuilder("[");
for (PartitionTopicInfo pti : partitionTopicInfos) {
- buf.append(pti.topic).append("-").append(pti.partition.partId).append(',');
+ buf.append(format("%s-%d-%d,", pti.topic,pti.partition.brokerId,pti.partition.partId));
}
buf.append(']');
logger.info(String.format("%s comsume at %s:%d with %s", getName(), broker.host, broker.port, buf.toString()));
@@ -117,7 +119,7 @@ public void run() {
}
}
//
- logger.info("stopping fetcher " + getName() + " to host " + broker);
+ logger.debug("stopping fetcher " + getName() + " to broker " + broker);
Closer.closeQuietly(simpleConsumer);
shutdownComplete();
}
@@ -102,7 +102,7 @@ public void close() {
}
private void close(SocketChannel socketChannel) {
- logger.info("Disconnecting consumer from " + channel.socket().getRemoteSocketAddress());
+ logger.debug("Disconnecting consumer from " + channel.socket().getRemoteSocketAddress());
Closer.closeQuietly(socketChannel);
Closer.closeQuietly(socketChannel.socket());
}
@@ -99,7 +99,7 @@ public void run() {
}
} catch (EOFException eofe) {
Socket socket = channelFor(key).socket();
- logger.info(format("connection closed by %s:%d.", socket.getInetAddress(), socket.getPort()));
+ logger.debug(format("connection closed by %s:%d.", socket.getInetAddress(), socket.getPort()));
close(key);
} catch (InvalidRequestException ire) {
Socket socket = channelFor(key).socket();

0 comments on commit 9da8aa4

Please sign in to comment.