34
votes

ASP.Net Core documentation here has a nice console logging output like in the picture below with colors for various LogLevels. I have now created an application in Visual Studio and I see that it now runs behind IIS Express and I don't see the console anymore. I remember when I did run beta, then it did pop up Kestrel directly with this nice Console output.

Is it possible to get this nice window now?

P.S. It's a bit strange that the documentation still contains these images that you cannot even see.

enter image description here

2
I have found that it is possible to do if you switch the profile that you are using from IISExpress to the one that has project name, then it seems Kestrel is run directly and I see output. This still leaves a question if it is possible to use with IISExpress.Ilya Chernomordik
Ilya can you provide more info? Just selecting the non-IIS Profile does not change anything for me.Daniel Williams
Sorry, that was enough for me: switch to direct kestrel profile. Then I got a nice console with logging, perhaps you did not set up logging correctly?Ilya Chernomordik
@DanielWilliams before you run the project press dropdown next to green run button on visual studio and select your project name instead of iis expres.So visual studio run itself without iis express and you can see the console.BMErEr

2 Answers

19
votes

In addition to Dawid Rutkowski's answer, on the top dropdown, don't select IISExpress, select the application name. You should be able to see the console and the web page.

11
votes

Yes, it's possible with IIS Express. Use Microsoft.Extensions.Logging.Debug nuget package: https://github.com/aspnet/Logging/tree/master/src/Microsoft.Extensions.Logging.Debug. Configure logger in the Startup.cs:

loggerFactory.MinimumLevel = LogLevel.Debug;
loggerFactory.AddDebug( LogLevel.Debug );
var logger = loggerFactory.CreateLogger("Startup");
logger.LogWarning("Logger configured!");

And:

Console.WriteLine("Hi!");