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

It's too hard to unconfigure default logging #648

Closed
rynowak opened this issue Jun 20, 2017 · 2 comments
Closed

It's too hard to unconfigure default logging #648

rynowak opened this issue Jun 20, 2017 · 2 comments

Comments

@rynowak
Copy link
Member

rynowak commented Jun 20, 2017

Imagine using WebHost.CreateDefaultBuilder but wanting to replace the default console logger with the serilog console logger.

You have to do something like:

var providers = b.Services.Where(d => d.ServiceType == typeof(ILoggerProvider)).ToArray();
foreach (var provider in providers)
{
    b.Services.Remove(provider);
}

This is pretty gross and non-obvious. Getting rid of CreateDefaultBuilder makes you fall off of a complexity cliff the other way.

@moozzyk
Copy link
Contributor

moozzyk commented Jun 21, 2017

Also see: aspnet/MetaPackages#162

@pakrym
Copy link
Contributor

pakrym commented Jul 7, 2017

Fixed by #659

There is ClearProviders extension method on ILoggerBuilder now.

@pakrym pakrym closed this as completed Jul 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants