diff --git a/src/Serilog.Sinks.Loki/LokiBatchFormatter.cs b/src/Serilog.Sinks.Loki/LokiBatchFormatter.cs index f61eae3..3f8269a 100644 --- a/src/Serilog.Sinks.Loki/LokiBatchFormatter.cs +++ b/src/Serilog.Sinks.Loki/LokiBatchFormatter.cs @@ -53,15 +53,8 @@ public void Format(IEnumerable logEvents, ITextFormatter formatter, Te var sb = new StringBuilder(); sb.AppendLine(logEvent.RenderMessage()); if (logEvent.Exception != null) - { - var e = logEvent.Exception; - while (e != null) - { - sb.AppendLine(e.Message); - sb.AppendLine(e.StackTrace); - e = e.InnerException; - } - } + // AggregateException adds a Environment.Newline to the end of ToString(), so we trim it off + sb.AppendLine(logEvent.Exception.ToString().TrimEnd()); foreach (KeyValuePair property in logEvent.Properties) {