Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Program
- {
- public static void Main(string[] args)
- {
- var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
- try
- {
- logger.Debug("init main");
- BuildWebHost(args).Run();
- }
- catch (Exception ex)
- {
- logger.Error(ex, "Stopped program because of exception");
- throw;
- }
- finally
- {
- // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
- NLog.LogManager.Shutdown();
- }
- }
- public static IWebHost BuildWebHost(string[] args) =>
- WebHost.CreateDefaultBuilder(args)
- .UseStartup<Startup>()
- .ConfigureLogging(logging =>
- {
- logging.ClearProviders();
- logging.SetMinimumLevel(LogLevel.Trace);
- })
- .UseNLog()
- .Build();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement