From d702a7c4219bb6b2efc46ec601dbb819f20d6a30 Mon Sep 17 00:00:00 2001 From: Andrei Ivanov Date: Thu, 4 Feb 2021 19:39:33 +0300 Subject: [PATCH] handled "Connection reset by peer" in a special way --- .../disthene/reader/server/ReaderServerHandler.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/iponweb/disthene/reader/server/ReaderServerHandler.java b/src/main/java/net/iponweb/disthene/reader/server/ReaderServerHandler.java index 066ca967..f276d00a 100644 --- a/src/main/java/net/iponweb/disthene/reader/server/ReaderServerHandler.java +++ b/src/main/java/net/iponweb/disthene/reader/server/ReaderServerHandler.java @@ -11,6 +11,7 @@ import net.iponweb.disthene.reader.handler.DistheneReaderHandler; import org.apache.log4j.Logger; +import java.io.IOException; import java.util.Map; import java.util.regex.Pattern; @@ -95,7 +96,12 @@ public void channelReadComplete(ChannelHandlerContext ctx) { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { - logger.error("Exception while processing request", cause); + // the check below is mostly because of "Connection reset by peer" exceptions overwhelming the log + if (cause instanceof IOException) { + logger.trace("Exception while processing request", cause); + } else { + logger.error("Exception while processing request", cause); + } ctx.close(); } }