Skip to content

Instantly share code, notes, and snippets.

@alistairjevans
Created October 4, 2019 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alistairjevans/9dc0d1c22fc13a86c089d57cf87654ef to your computer and use it in GitHub Desktop.
Save alistairjevans/9dc0d1c22fc13a86c089d57cf87654ef to your computer and use it in GitHub Desktop.
Program.cs with Nlog
public static void Main(string[] args)
{
// NLog: setup the nlog config first; this will configure all subsequent nlog factories
// with our nlog config.
NLogBuilder.ConfigureNLog("nlog.config");
var host = Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webHostBuilder =>
{
webHostBuilder
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>();
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Trace);
})
// Use NLog to provide ILogger instances.
.UseNLog()
.Build();
host.Run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment