AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException; Application.ThreadException += Application_ThreadException; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { EasyLogger.Error(e.Exception.Message + " Application.ThreadException"); } static void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { EasyLogger.Error(((Exception)e.ExceptionObject).Message + " AppDomain.UnhandledException"); }