Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Should frameworks like Serilog, NLog implement their own ILoggerFactory? #420

Closed
@cwe1ss

Description

@cwe1ss

cc @304NotModified @nblumhardt

Since it is now possible to pass a custom ILoggerFactory into the WebHostBuilder by calling IWebHostBuilder.UseLoggerFactory(ILoggerFactory loggerFactory), I'm wondering if it would make more sense for 3rd party frameworks like Serilog, NLog to implement their own ILoggerFactory in addition to (or even instead of) a ILoggerProvider?

To me, it seems like ILoggerProvider is better for actual outputs like Console, EventLog, ... and ILoggerFactory would be better for frameworks. It's not really useful to combine a provider from M.E.L (e.g. Console) with sinks from Serilog because Serilog has a sink for each M.E.L-provider anyway. So, routing all logs through Microsoft.Extensions.Logging.dll seems like an unnecessary step.

If all logging frameworks would implement ILoggerFactory, we could also think about removing the assembly Microsoft.Extensions.Logging.dll from aspnet/hosting! The choice of a logging framework is the same as the choice of a server (e.g. Kestrel) IMO. This means, Microsoft.Extensions.Logging (which is just Microsoft's implementation) could be part of the template, but if someone wants to use Serilog/NLog he would remove the dependency and therefore wouldn't have Microsoft.Extensions.Logging.dll on disk anymore.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions