static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, a) => { if (Log.Logger == null) return; if (a.IsTerminating) Log.Logger.Fatal(a.ExceptionObject as Exception, "Unhandled Exception"); else { Log.Logger.Information( a.ExceptionObject as Exception, "Non-Fatal Unhandled Exception"); } }; app = new RunServiceApp(); app.Run(); }
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, a) => { if (Log.Logger == null) { return; } if (a.IsTerminating) { Log.Logger.Fatal(a.ExceptionObject as Exception, "Unhandled Exception"); } else { Log.Logger.Information( a.ExceptionObject as Exception, "Non-Fatal Unhandled Exception"); } }; app = new RunServiceApp(); app.Run(); }