serilog-extensions-logging icon indicating copy to clipboard operation
serilog-extensions-logging copied to clipboard

UseSerilogRequestLogging and additional providers

Open EDKAMO opened this issue 1 year ago • 1 comments
trafficstars

We used to do this:

 // Configure logging providers
 builder.Logging.ClearProviders();
 builder.Logging.AddSerilog();
 builder.Logging.AddCustomLoggerProvider();

However, to use UseSerilogRequestLogging you have to do services.AddSerilog()

I can't manage to get the custom logger provider to work. We tried using AddSerilog(this IServiceCollection collection, ILogger logger = null, bool dispose = false, LoggerProviderCollection providers = null) but it doesn't seem to work.

per https://github.com/serilog/serilog-aspnetcore/blob/680af2e3c6b16740366d6dc4a96d20cfa9ceab01/README.md?plain=1#L51

The builder.Services.AddSerilog() call will redirect all log events through your Serilog pipeline.

How can we add custom logger providers to the Serilog pipeline?

EDKAMO avatar Sep 10 '24 04:09 EDKAMO

Best to ask usage questions on stackoverflow.com to get more eyes on it....

bartelink avatar Sep 10 '24 04:09 bartelink