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

Could WebHostExtensions.Run() use Logging? #979

@gingters

Description

@gingters

Hello,

I have an issue with WebHostExtensions.Run() using Console.WriteLine() instead of writing its log entries to an ILogger instance, just like this.

It seems pretty unintuitive that, after you already haved configured your logging etc. in the WebHostBuilder.Build() method, that the .Run() method after that should not be able to leverage this information.

So I would like to propose that the WebHostExtensions.Run() should try to resolve an ILogger from the host.Services just as it does with the hostingEnvironment and applicationLifetime, and use that if available. Only if there is no logger available it should fall back to writing to the Console directly.

What do you think about this? Could we make this happen?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions