Hello,
Here is what i've done: I have injected an ILogger in my Controller's constructor:
public MyController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
_logger.LogError("Here is a log message");
return View();
}
And Here is what i've changed in Program.cs:
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole();
logging.AddDebug();
})
.UseStartup<Startup>()
.Build();
}
The application is hosted on a Windows Server computer with IIS.
The application works fine but i cannot find where the log is written...
Thanks