Skip to content

manishmahajan123/Serilog.Enrichers.Correlation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serilog.Enrichers.Correlation

Use this to enrich logs with a Correlation Id

Configure serilog is as follows;

"serilog": {
   "minimumLevel": { },
   "writeTo": [ ],
   "enrich": [ "WithCorrelation" ]
}

There is also a fix in this libarey for a known issue with ASP.NET core 2.2.0, which results in the correlation is not being set. To use the fix, do the following in your Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
   services.AddDiagnosticObserver<CorrelationIdObserver>();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider, IApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory)
{
   serviceProvider.UseDiagnosticObserver<CorrelationIdObserver>();
}

To install from nuget;

Install-Package Serilog.Enrichers.Correlation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%