Created
October 4, 2019 14:28
-
-
Save alistairjevans/9dc0d1c22fc13a86c089d57cf87654ef to your computer and use it in GitHub Desktop.
Program.cs with Nlog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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