From ee1837adf6d3fca2cc3367ce4826b06031a85975 Mon Sep 17 00:00:00 2001 From: andsel Date: Thu, 8 Aug 2024 14:32:37 +0200 Subject: [PATCH] Splitter WARN log in WARN and DEBUG with the full stacktrace --- .../org/logstash/execution/AbstractPipelineExt.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/logstash-core/src/main/java/org/logstash/execution/AbstractPipelineExt.java b/logstash-core/src/main/java/org/logstash/execution/AbstractPipelineExt.java index f29be12b900..3ea89997654 100644 --- a/logstash-core/src/main/java/org/logstash/execution/AbstractPipelineExt.java +++ b/logstash-core/src/main/java/org/logstash/execution/AbstractPipelineExt.java @@ -21,6 +21,8 @@ package org.logstash.execution; import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; import java.nio.file.FileStore; import java.nio.file.Files; import java.nio.file.Paths; @@ -178,7 +180,13 @@ public final class LogErrorEvaluationListener implements ConditionalEvaluationLi @Override public void notify(ConditionalEvaluationError err) { lastErrorEvaluationReceived = err.getMessage(); - LOGGER.warn("Error in condition evaluation with event {}", err.failedEvent().getField("[event][original]"), err); + LOGGER.warn("Error in condition evaluation with error {} on event {}", lastErrorEvaluationReceived, err.failedEvent().getField("[event][original]")); + try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { + err.printStackTrace(pw); + LOGGER.debug("{}", sw); + } catch (IOException ioex) { + LOGGER.warn("Invalid operation on closing internal resources", ioex); + } } }