using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BodyshopPartner.Utils { public static class ApplicationExceptionHandler { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); public static void InitExceptionHandlers() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //do something with the file contents } public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { logger.Fatal((e.ExceptionObject as Exception), "Unhandled generic exception. "); } } }