From 62366ef23be2348e46075fa9579b50f86c09edc5 Mon Sep 17 00:00:00 2001 From: angeljqv <79208641+angeljqv@users.noreply.github.com> Date: Thu, 23 Oct 2025 13:27:47 -0500 Subject: [PATCH] Avoid empty espace on empty trace (#1979) --- src/Monolog/Formatter/LineFormatter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Monolog/Formatter/LineFormatter.php b/src/Monolog/Formatter/LineFormatter.php index fd9dc5bb..d26204a3 100644 --- a/src/Monolog/Formatter/LineFormatter.php +++ b/src/Monolog/Formatter/LineFormatter.php @@ -303,6 +303,10 @@ class LineFormatter extends NormalizerFormatter $trace = str_replace("\n", "\n{$this->indentStacktraces}", $trace); } + if (trim($trace) === '') { + return ''; + } + return "\n{$this->indentStacktraces}[stacktrace]\n{$this->indentStacktraces}" . $trace . "\n"; }