Serilog enrichers for Servicestack


I’m using Servicestack (.Core) and it’s connection to Serilog. Is there a way to automatically enrich all Log-Entries with things like SessionId, UserId, etc… The existing serilog-enrichers will not work due servicestack uses it’s own session and user handling.

kind regards

Not sure if @mythz has a better answer, but I made a custom IRequestLogger plugin, and pushed whatever properties I needed using ILog.PushProperty

Hey @jrodrigu,

thanks for your suggestion, I’ll have a look at that.

There’s an example for a Serilog enricher answered on StackOverflow at:

If your AppHost supports accessing the Request context via a singleton you can access it from:


However it’s disabled by default in .NET Core and requires registering a HttpContextAccessor: