I generated a new project for ASP.Net Core 2.0. Added this code in Program.cs
:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
...
Then I go to the folder containing the project and run dotnet run
:
Hosting environment: Development
Content root path: C:\Users\arthur\Source\Repos\WebApplication5\WebApplication5
Now listening on: http://localhost:3000
Application started. Press Ctrl+C to shut down
While navigating the site I want to see the logs generated by framework but I see nothing. Though if I generate ASP.Net Core 1.1 web project the lines with logging are already in Program.cs
and I see the logs:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:53680/
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method WebApplication3.Controllers.HomeController.Index (WebApplication3) with arguments ((null)) - ModelState is Valid
What am I missing?
Ok, I feel a bit stupid now, but to achieve what I wanted I had to change LogLevel
of Debug
and Console
in appsettings.json to something lower that Warning
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With