private void LogError(ErrorMessageResID resID, string logSource, Exception exp, params object[] args) { try { StringBuilder messageBuilder = new StringBuilder(); if (args != null && args.Length > 0) { //messageBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, ResourceManager.GetErrorMessage(resID), args)); } else { //messageBuilder.AppendLine(ResourceManager.GetErrorMessage(resID)); } if (!logSource.Equals(string.Empty)) { messageBuilder.AppendLine("Log Source : " + logSource); } messageBuilder.AppendLine(GetExceptionMessage(exp)); LogEntry log = new LogEntry(); log.Message = messageBuilder.ToString(); log.Priority = 5; log.EventId = resID.GetHashCode(); log.Categories.Clear(); log.Categories.Add("Error Log"); log.Categories.Add("Debug"); Logger.Write(log); } catch (Exception ex) { NotifyLoggingFailure(ex); } }
/// <summary> /// Get Error message based on the param /// </summary> /// <param name="resValue"></param> /// <returns></returns> public string GetErrorMessageInstance(ErrorMessageResID resValue) { return(cache.GetErrorMessage(APConvert.ToString(resValue.GetHashCode()))); }