diff --git a/src/main/java/org/logstash/beats/BeatsHandler.java b/src/main/java/org/logstash/beats/BeatsHandler.java index 8768c2a2..e83e940b 100644 --- a/src/main/java/org/logstash/beats/BeatsHandler.java +++ b/src/main/java/org/logstash/beats/BeatsHandler.java @@ -92,18 +92,23 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E } } else { final Throwable realCause = extractCause(cause, 0); - if (logger.isDebugEnabled()) { - logger.info(format("Handling exception: " + cause + " (caused by: " + realCause + ")"), cause); - } else { - logger.info(format("Handling exception: " + cause + " (caused by: " + realCause + ")")); - } // when execution tasks rejected, no need to forward the exception to netty channel handlers if (cause instanceof RejectedExecutionException) { + if (logger.isDebugEnabled()) { + logger.info(format("Handling exception: " + cause + " (caused by: " + realCause + ")"), cause); + } else { + logger.info(format("Handling exception: " + cause + " (caused by: " + realCause + ")")); + } // we no longer have event executors available since they are terminated, mostly by shutdown process if (Objects.nonNull(cause.getMessage()) && cause.getMessage().contains(executorTerminatedMessage)) { this.isQuietPeriod.compareAndSet(false, true); } } else { + if (logger.isDebugEnabled()) { + logger.warn(format("Unhandled exception: " + cause + " (caused by: " + realCause + ")"), cause); + } else { + logger.warn(format("Unhandled exception: " + cause + " (caused by: " + realCause + ")")); + } super.exceptionCaught(ctx, cause); } }