public static void DisposeApp() { AppLogger.CloseLogfiles(); AppLogger = null; Logger.CloseLogfiles(); Logger = null; FormatWriter.dispose(); }
static AppGlobal() { AppLogger = new AppLog(); Logger = new AppErrorLog(); FormatWriter = new LogFormatter(ref Logger); AppLogger.GenerateLogfiles(Application.StartupPath + "\\" + Application.ProductName + "\\ApplicationLog", "Trace_" + Application.ProductName); Logger.GenerateLogfiles(Application.StartupPath + "\\" + Application.ProductName + "\\ApplicationLog", Application.ProductName); }
public void CaptureErrorValues(string error) { var uow = new UnitOfWork(); var AppErrorLog = new AppErrorLog(); AppErrorLog.ErrorMsg = error; AppErrorLog.datelog = BaseUtil.GetCurrentDateTime(); uow.AppErrorLog_.Add(AppErrorLog); }
public void Add(AppErrorLog log) { try { DbInstance.AppErrorLogs.Add(log); DbInstance.SaveChangesAsync(); } catch (Exception ex) { throw ex; } }
protected override void OnException(ExceptionContext exceptionContext) { sbv_uuwebstoreEntities db = new sbv_uuwebstoreEntities(); if (!exceptionContext.ExceptionHandled) { var uow = new UnitOfWork(); var AppErrorLog = new AppErrorLog(); AppErrorLog.ErrorMsg = exceptionContext.Exception.Message; AppErrorLog.datelog = BaseUtil.GetCurrentDateTime(); if (exceptionContext.Exception.InnerException != null) { AppErrorLog.innerException = exceptionContext.Exception.InnerException.Message; AppErrorLog.stackTrace = exceptionContext.Exception.StackTrace; } uow.AppErrorLog_.Add(AppErrorLog); TempData["error"] = exceptionContext.Exception.Message; TempData["innererror"] = exceptionContext.Exception.InnerException; exceptionContext.ExceptionHandled = true; exceptionContext.Result = new RedirectResult("~/Views/Shared/Error.cshtml"); return; } }