I've been using serilog recently and its proving to be extremely useful and easy to use. One of the nice features of serilog is enrichers. They allow you add properties to your log events. You can find out more about them here

An application I was troubleshooting the other day was getting a WebServiceException from a servicestack api request, the stacktrace was added to my logging events but it wasn't that easy to find the relevant exception information.

This is the perfect use-case for an enricher, so I wrote one. This allowed me to map the exception properties as log event properties in my structured logevent data.

To add this to your log config is as easy as

\\ using serilog;
var log = new LoggerConfiguration()  
    .Enrich.With<ServiceStackExceptionEnricher>()
    .WriteTo.Console()
    .CreateLogger();

Now I can see and search for all those exception properties in my log sinks.

Perfect! :)