Skip to content

Not consistant logging across Hosting #5910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Muchaszewski opened this issue Jan 19, 2018 · 3 comments
Closed

Not consistant logging across Hosting #5910

Muchaszewski opened this issue Jan 19, 2018 · 3 comments
Labels
area-hosting Includes Hosting area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Milestone

Comments

@Muchaszewski
Copy link

Following files and methods contains Console.Write or Console.WriteLine instead of using ILogger interface. That information, though informational might be useful in debugging process on remote host where we do not read console directly.

Following files should have replaced those Console.Write with _logger.LogInformation(...):
src/Microsoft.Extensions.Hosting/Internal/ConsoleLifetime.cs:35-37
src/Microsoft.AspNetCore.Hosting/WebHostExtensions.cs:100,101,109

Following files should have replaced those Console.Write with _logger.LogError(...):
src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs:163,168
src/Microsoft.AspNetCore.Hosting/Internal/WebHost.cs:226

Following files and lines were provided from commit: 9f4c7c172f4876db77cc3b4e1eef50e61608ac60

@muratg
Copy link
Contributor

muratg commented Feb 6, 2018

Some of these are by-design, i.e. for cases it tells you what port is used. Some of the could be using logger.

If you're interested in sending a PR, let me know. :) Putting this in backlog milestone now.

@aspnet-hello aspnet-hello transferred this issue from aspnet/Hosting Dec 18, 2018
@aspnet-hello aspnet-hello added this to the Backlog milestone Dec 18, 2018
@gthvidsten
Copy link

I've just encountered this issue and found it very confusing that I set up logging, but the startup messages for WebHost only appeared in the console and not in the logs.

WebHost should not behave radically different than a generic host. A generic host logs startup messages to the logger you define, but WebHost does not (as evidenced by the source code).

I would strongly suggest making a WebHost output startup messages to the logger instead of to the console. First and foremost for consistency across various hosts, but also to prevent confusion about messages not appearing in any logs.

@Tratcher
Copy link
Member

Tratcher commented Nov 9, 2020

Closing. These issues were fixed in IHost and ConsoleLifetime and we plan to obsolete WebHost. #20964

@Tratcher Tratcher closed this as completed Nov 9, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
@amcasey amcasey added the area-hosting Includes Hosting label Jun 1, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-hosting Includes Hosting area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

7 participants