Asp.net core + IIS Express. How to view log messages?
You can use the Debug
listener to achieve what you want:
"dependencies": {
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
}
Console.WriteLine( "Hello World!" );
loggerFactory.MinimumLevel = LogLevel.Debug;
loggerFactory.AddDebug( LogLevel.Debug );
var logger = loggerFactory.CreateLogger("Startup");
logger.LogWarning( "Hi!" );
IIS Express will not output its logs to Visual Studio's output window.
You'll need to use a different log provider.
Write it to a log file. You can use a library for that, for example Serilog:
using Serilog;
public class Startup
{
public Startup(IHostingEnvironment env)
{
Log.Logger = new LoggerConfiguration()
.WriteTo.File("log.txt")
.CreateLogger();
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env,
ILoggerFactory loggerFactory)
{
loggerFactory.AddSerilog();
You'll need this NuGet package.
Go to Documents => IISExpress => Logs.
This is what you are looking for.