From 3c5268010e6c46a5a906cf139e34faffc67139e1 Mon Sep 17 00:00:00 2001 From: Bertrand Renuart Date: Wed, 29 Sep 2021 15:55:38 +0200 Subject: [PATCH] Don't repeat exception cause message when attaching the exception to the status The default "OnConsoleStatusListener" already appends the cause's message when printing tth status on the console. Addining it in the original message will cause duplicates on the console. Those not relying on the "OnConsoleStatusLisener" should simply retrieve additional information from the status throwable if any (what they probaby already do for ErrorStatus anyway...) --- .../logback/appender/AbstractLogstashTcpSocketAppender.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java b/src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java index 75e40d98..872a2dff 100644 --- a/src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java +++ b/src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java @@ -574,7 +574,7 @@ public void onEvent(LogEvent logEvent, long sequence, boolean endOfBatch) /* * Encoding threw an exception. Warn and drop event before it becomes a "poison". */ - addWarn(peerId + "Encoder failed to encode event: " + e.getMessage() + ". Dropping event.", e.getCause()); + addWarn(peerId + "Encoder failed to encode event. Dropping event.", e.getCause()); fireEventSendFailure(logEvent.event, e.getCause()); break; @@ -583,7 +583,7 @@ public void onEvent(LogEvent logEvent, long sequence, boolean endOfBatch) * Any other exception is thrown by the socket stream (or bug in the code). * Re-open the socket and get a fresh new stream. */ - addWarn(peerId + "Unable to send event: " + e.getMessage() + ". Reconnecting.", e); + addWarn(peerId + "Unable to send event. Reconnecting.", e); reopenSocket(); } }