Use outputTemplate in HTTP sink for Exception logging

38 views Asked by At

Trying to send logs to remote http server using serilog-sinks-http and Serilog.Exceptions is required to get exception details.

In Serilog.Exceptions documents it required outputTemplate to be set to {Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception} {Properties:j} to work.

Couldn't find outputTemplate parameter in HTTP Sink, now logs look similar to:

03/06/2024 13:00:00 +03:30 [Error] Error occured
System.DivideByZeroException: Attempted to divide by zero.
   at logexample.Program.Main(String[] args) in D:\repos\logexample\Program.cs:line 29

Also innerException is needed to be placed in logs (innerException itself may contain another innerException which all are needed).

0

There are 0 answers