net core 3.1 logging to file code example
Example 1: asp.net core logger in startup
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILogger<Startup> logger)
{
logger.LogInformation("Configure called");
// …
}
Example 2: loggerfactory asp.net core 3.0
using (var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()))
{
// use loggerFactory
}