Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public static class Program
  2. {
  3. public static void Main(string[] args)
  4. {
  5. var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
  6. try
  7. {
  8. logger.Debug("init main");
  9. BuildWebHost(args).Run();
  10. }
  11. catch (Exception ex)
  12. {
  13. logger.Error(ex, "Stopped program because of exception");
  14. throw;
  15. }
  16. finally
  17. {
  18. // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
  19. NLog.LogManager.Shutdown();
  20. }
  21. }
  22.  
  23. public static IWebHost BuildWebHost(string[] args) =>
  24. WebHost.CreateDefaultBuilder(args)
  25. .UseStartup<Startup>()
  26. .ConfigureLogging(logging =>
  27. {
  28. logging.ClearProviders();
  29. logging.SetMinimumLevel(LogLevel.Trace);
  30. })
  31. .UseNLog()
  32. .Build();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement