public static void LogException(BaseException ex, string className, string methodName) { if (ex.InsertedLog) { return; } ex.InsertedLog = true; string curentUsername = Security.BUser.CurrentUser.UserName; if (curentUsername.ToLower().Equals("nunituser")) { return; } if (IsBusinessErrorLogEnable) { if (ex is InvalidPersianDateException) { businessErrorlogger.Error(curentUsername, className, methodName, "GTS.Clock.Business", " InvalidPersianDateException --> " + ((InvalidPersianDateException)ex).GetLogMessage(), ex); } else if (ex is UIBaseException) { businessErrorlogger.Error(curentUsername, className, methodName, "GTS.Clock.Business", String.Format("{0} --> {1}", ex.GetType().Name, ((UIBaseException)ex).GetLogMessage()), ex); } else { businessErrorlogger.Error(curentUsername, className, methodName, "GTS.Clock.Business", String.Format("{0} --> {1}", ex.GetType().Name, ((BaseException)ex).GetLogMessage()), ex); } } }
protected void LogException(BaseException ex, string className, string methodName, string currentUserName, bool isBusinessLogEnable) { if (ex.InsertedLog) { return; } ex.InsertedLog = true; string curentUsername = currentUserName; if (curentUsername.ToLower().Equals("nunituser")) { return; } if (isBusinessLogEnable) { if (ex is InvalidPersianDateException) { businessErrorlogger.Error(curentUsername, className, methodName, "BaseGTSBusiness", " InvalidPersianDateException --> " + ((InvalidPersianDateException)ex).GetLogMessage(), ex); } else if (ex is UIBaseException) { businessErrorlogger.Error(curentUsername, className, methodName, "BaseGTSBusiness", String.Format("{0} --> {1}", ex.GetType().Name, ((UIBaseException)ex).GetLogMessage()), ex); } else { businessErrorlogger.Error(curentUsername, className, methodName, "BaseGTSBusiness", String.Format("{0} --> {1}", ex.GetType().Name, ((BaseException)ex).GetLogMessage()), ex); } } }
protected void Button4_Click(object sender, EventArgs e) { Infrastructure.Log.BusinessServiceLogger log = new BusinessServiceLogger(); log.Error("21321", "test"); log.Flush(); }
private void LogException(Exception ex, string methodName, string info) { logger.Error(info, "GTSMembershipProvider", methodName, "GTS.Clock.Repository", Utility.GetExecptionMessage(ex), ex); }
protected void Btn1_Click(object sender, EventArgs e) { busLogger.Error("323232", "sdfasdfasdasdasdas", new Exception("asdasdasdas")); busLogger.Flush(); }