Nenad
Nenad

Reputation: 26727

Serilog and ASP.NET Core enrich `WithUserName` and `WithHttpRequestUserAgent`?

Is there a way to enrich Serilog log data in ASP.NET Core 2.1 application, similar to how enrichers WithUserNameand WithHttpRequestUserAgent work for classic ASP.NET (System.Web)?

I tried implementing ILogEventEnricher interface, but it does not work, because I am not able to gain access to RequestContext from my custom enricher.

Upvotes: 2

Views: 5373

Answers (1)

Jean-Paul
Jean-Paul

Reputation: 379

As pointed out in the comments it seems like Add Username into Serilog would serve your purpose and would also be the duplicate of this issue.

Upvotes: 0

Related Questions