serilog / serilog-extensions-logging

Serilog provider for Microsoft.Extensions.Logging
Apache License 2.0
307 stars 97 forks source link

Reasons to use serilog-aspnetcore #178

Closed Leon99 closed 9 months ago

Leon99 commented 3 years ago

The readme mentions that serilog-aspnetcore should be used for .NET Core 2.0+ but doesn't explain the reasons. Furthermore, later it mentions configuration steps required specifically for .NET Core 2.0+ which makes it more confusing.

From reading serilog-aspnetcore's readme, it looks like it's actually worse as it can't be configured conditionally based on configuration settings as it's not available during host building. UseSerilogRequestLogging(), on the other hand, seems to be a useful addition. Anything else? It'd be great to have a clear comparison between the packages right in the readme.

nblumhardt commented 3 years ago

Hi! There's a UseSerilog() overload that accepts a callback, providing access to configuration etc., so I think it should support what you're looking for.

For an explanation and discussion of the differences between these packages check out

HTH, and feedback on how to present this in the README still very welcome :+1:

Leon99 commented 3 years ago

Thanks Nick. Those pages explain how to set up Serilog.Extensions.Hosting/Serilog.AspNetCore but there's no direct comparison with Serilog.Extensions.Logging. From what I understood so far, Serilog.Extensions.Logging just adds Serilog as an additional logging provider for the built-in logging, but Serilog.Extensions.Hosting/Serilog.AspNetCore fully replaces it, does that sound right?

As for the configuration, I need to be able to use Seq based on the configuration setting and preserve the built-in logging configuration and behaviour. The Seq logging provider doesn't support enrichments, so I have to use full Serilog.

nblumhardt commented 3 years ago

From what I understood so far, Serilog.Extensions.Logging just adds Serilog as an additional logging provider for the built-in logging, but Serilog.Extensions.Hosting/Serilog.AspNetCore fully replaces it, does that sound right?

Yes, that's correct.

he Seq logging provider doesn't support enrichments, so I have to use full Serilog.

Could be one for us to think more about - thanks!

nblumhardt commented 9 months ago

Closing this one as stale. Hope all's going well, Leon 👋