serilog-sinks-elasticsearch icon indicating copy to clipboard operation
serilog-sinks-elasticsearch copied to clipboard

Log Events not Written to Sink with Inner Exceptions

Open msfreed opened this issue 5 years ago • 2 comments

Does this issue relate to a new feature or an existing bug?

  • [x] Bug
  • [ ] New Feature

What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package. 8.0.0

What is the target framework and operating system? See target frameworks & net standard matrix.

  • [ ] netCore 2.0
  • [ ] netCore 1.0
  • [x] 4.7
  • [ ] 4.6.x
  • [ ] 4.5.x

Please describe the current behavior? Log events are not being written to the configured sink/s if either the ElasticsearchJsonFormatter OR ExceptionAsObjectJsonFormatter are configured AND the Error level is specified AND an exception is specified with an inner exception AND formatStackTrackAsArray is set to true.

Please describe the expected behavior? Log events with an inner exception would be written to the configured sink/s

If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem

var logger = new LoggerConfiguration()
   .WriteTo.Console(new ElasticsearchJsonFormatter(formatStackTraceAsArray: true))
   .CreateLogger();
logger.Error(new Exception("outer", new Exception("inner")), "failure");

msfreed avatar Oct 10 '19 23:10 msfreed

This is also reproducible on .NET Core 2.x

marcin-brzozowski avatar Oct 17 '19 16:10 marcin-brzozowski

Merged to dev, so a package should be available soon.

mivano avatar Oct 19 '19 18:10 mivano