Пример #1
0
 public void AddLog(LogInfo objLogInfo)
 {
     if (Globals.Status == Globals.UpgradeStatus.Install)
     {
         AddLogToFile(objLogInfo);
     }
     else
     {
         try
         {
             objLogInfo.LogCreateDate = DateTime.Now;
             objLogInfo.LogServerName = Common.Globals.ServerName;
             if (string.IsNullOrEmpty(objLogInfo.LogServerName))
             {
                 objLogInfo.LogServerName = "NA";
             }
             if (String.IsNullOrEmpty(objLogInfo.LogUserName))
             {
                 if (HttpContext.Current != null && HttpContext.Current.Request != null)
                 {
                     if (HttpContext.Current.Request.IsAuthenticated)
                     {
                         UserInfo objUserInfo = UserController.GetCurrentUserInfo();
                         objLogInfo.LogUserName = objUserInfo.Username;
                     }
                 }
             }
             LoggingProvider.Instance().AddLog(objLogInfo);
         }
         catch (Exception exc)
         {
             AddLogToFile(objLogInfo);
         }
     }
 }
 public void AddLog(Exception objException, ExceptionLogType LogType)
 {
     LogController objLogController = new LogController();
     LogInfo objLogInfo = new LogInfo();
     objLogInfo.LogTypeKey = LogType.ToString();
     if (LogType == ExceptionLogType.SEARCH_INDEXER_EXCEPTION)
     {
         SearchException objSearchException = (SearchException)objException;
         objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objSearchException.SearchItem.ModuleId.ToString()));
         objLogInfo.LogProperties.Add(new LogDetailInfo("SearchItemId", objSearchException.SearchItem.SearchItemId.ToString()));
         objLogInfo.LogProperties.Add(new LogDetailInfo("Title", objSearchException.SearchItem.Title));
         objLogInfo.LogProperties.Add(new LogDetailInfo("SearchKey", objSearchException.SearchItem.SearchKey));
         objLogInfo.LogProperties.Add(new LogDetailInfo("GUID", objSearchException.SearchItem.GUID));
     }
     else if (LogType == ExceptionLogType.MODULE_LOAD_EXCEPTION)
     {
         ModuleLoadException objModuleLoadException = (ModuleLoadException)objException;
         objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objModuleLoadException.ModuleId.ToString()));
         objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleDefId", objModuleLoadException.ModuleDefId.ToString()));
         objLogInfo.LogProperties.Add(new LogDetailInfo("FriendlyName", objModuleLoadException.FriendlyName));
         objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleControlSource", objModuleLoadException.ModuleControlSource));
     }
     else if (LogType == ExceptionLogType.SECURITY_EXCEPTION)
     {
         SecurityException objSecurityException = (SecurityException)objException;
         objLogInfo.LogProperties.Add(new LogDetailInfo("Querystring", objSecurityException.Querystring));
         objLogInfo.LogProperties.Add(new LogDetailInfo("IP", objSecurityException.IP.ToString()));
     }
     BasePortalException objBasePortalException = new BasePortalException(objException.ToString(), objException);
     objLogInfo.LogProperties.Add(new LogDetailInfo("AssemblyVersion", objBasePortalException.AssemblyVersion));
     objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objBasePortalException.PortalID.ToString()));
     objLogInfo.LogProperties.Add(new LogDetailInfo("PortalName", objBasePortalException.PortalName));
     objLogInfo.LogProperties.Add(new LogDetailInfo("UserID", objBasePortalException.UserID.ToString()));
     objLogInfo.LogProperties.Add(new LogDetailInfo("UserName", objBasePortalException.UserName));
     objLogInfo.LogProperties.Add(new LogDetailInfo("ActiveTabID", objBasePortalException.ActiveTabID.ToString()));
     objLogInfo.LogProperties.Add(new LogDetailInfo("ActiveTabName", objBasePortalException.ActiveTabName));
     objLogInfo.LogProperties.Add(new LogDetailInfo("RawURL", objBasePortalException.RawURL));
     objLogInfo.LogProperties.Add(new LogDetailInfo("AbsoluteURL", objBasePortalException.AbsoluteURL));
     objLogInfo.LogProperties.Add(new LogDetailInfo("AbsoluteURLReferrer", objBasePortalException.AbsoluteURLReferrer));
     objLogInfo.LogProperties.Add(new LogDetailInfo("UserAgent", objBasePortalException.UserAgent));
     objLogInfo.LogProperties.Add(new LogDetailInfo("DefaultDataProvider", objBasePortalException.DefaultDataProvider));
     objLogInfo.LogProperties.Add(new LogDetailInfo("ExceptionGUID", objBasePortalException.ExceptionGUID));
     objLogInfo.LogProperties.Add(new LogDetailInfo("InnerException", objBasePortalException.InnerException.Message));
     objLogInfo.LogProperties.Add(new LogDetailInfo("FileName", objBasePortalException.FileName));
     objLogInfo.LogProperties.Add(new LogDetailInfo("FileLineNumber", objBasePortalException.FileLineNumber.ToString()));
     objLogInfo.LogProperties.Add(new LogDetailInfo("FileColumnNumber", objBasePortalException.FileColumnNumber.ToString()));
     objLogInfo.LogProperties.Add(new LogDetailInfo("Method", objBasePortalException.Method));
     objLogInfo.LogProperties.Add(new LogDetailInfo("StackTrace", objBasePortalException.StackTrace));
     objLogInfo.LogProperties.Add(new LogDetailInfo("Message", objBasePortalException.Message));
     objLogInfo.LogProperties.Add(new LogDetailInfo("Source", objBasePortalException.Source));
     objLogInfo.LogPortalID = objBasePortalException.PortalID;
     objLogController.AddLog(objLogInfo);
 }
Пример #3
0
 private void AddLogToFile(LogInfo objLogInfo)
 {
     try
     {
         string str = objLogInfo.Serialize();
         string f;
         f = Common.Globals.HostMapPath + "\\Logs\\LogFailures.xml.resources";
         WriteLog(f, str);
     }
     catch (Exception exc)
     {
         exc.ToString();
     }
 }
 public abstract object GetSingleLog(LogInfo LogInfo, ReturnType objReturnType);
 public abstract void DeleteLog(LogInfo LogInfo);
 public abstract void AddLog(LogInfo LogInfo);
 public void AddLog(object objCBO, PortalSettings _PortalSettings, int UserID, string UserName, string LogType)
 {
     LogController objLogController = new LogController();
     LogInfo objLogInfo = new LogInfo();
     objLogInfo.LogUserID = UserID;
     objLogInfo.LogTypeKey = LogType.ToString();
     if (_PortalSettings != null)
     {
         objLogInfo.LogPortalID = _PortalSettings.PortalId;
         objLogInfo.LogPortalName = _PortalSettings.PortalName;
     }
     switch (objCBO.GetType().FullName)
     {
         case "CommonLibrary.Entities.Portals.PortalInfo":
             PortalInfo objPortal = (PortalInfo)objCBO;
             objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objPortal.PortalID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("PortalName", objPortal.PortalName));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Description", objPortal.Description));
             objLogInfo.LogProperties.Add(new LogDetailInfo("KeyWords", objPortal.KeyWords));
             objLogInfo.LogProperties.Add(new LogDetailInfo("LogoFile", objPortal.LogoFile));
             break;
         case "CommonLibrary.Entities.Tabs.TabInfo":
             TabInfo objTab = (TabInfo)objCBO;
             objLogInfo.LogProperties.Add(new LogDetailInfo("TabID", objTab.TabID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objTab.PortalID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("TabName", objTab.TabName));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Title", objTab.Title));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Description", objTab.Description));
             objLogInfo.LogProperties.Add(new LogDetailInfo("KeyWords", objTab.KeyWords));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Url", objTab.Url));
             objLogInfo.LogProperties.Add(new LogDetailInfo("ParentId", objTab.ParentId.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("IconFile", objTab.IconFile));
             objLogInfo.LogProperties.Add(new LogDetailInfo("IsVisible", objTab.IsVisible.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("SkinSrc", objTab.SkinSrc));
             objLogInfo.LogProperties.Add(new LogDetailInfo("ContainerSrc", objTab.ContainerSrc));
             break;
         case "CommonLibrary.Entities.Modules.ModuleInfo":
             ModuleInfo objModule = (ModuleInfo)objCBO;
             objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objModule.ModuleID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleTitle", objModule.ModuleTitle));
             objLogInfo.LogProperties.Add(new LogDetailInfo("TabModuleID", objModule.TabModuleID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("TabID", objModule.TabID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objModule.PortalID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleDefId", objModule.ModuleDefID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("FriendlyName", objModule.DesktopModule.FriendlyName));
             objLogInfo.LogProperties.Add(new LogDetailInfo("IconFile", objModule.IconFile));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Visibility", objModule.Visibility.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("ContainerSrc", objModule.ContainerSrc));
             break;
         case "CommonLibrary.Entities.Users.UserInfo":
             UserInfo objUser = (UserInfo)objCBO;
             objLogInfo.LogProperties.Add(new LogDetailInfo("UserID", objUser.UserID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("FirstName", objUser.Profile.FirstName));
             objLogInfo.LogProperties.Add(new LogDetailInfo("LastName", objUser.Profile.LastName));
             objLogInfo.LogProperties.Add(new LogDetailInfo("UserName", objUser.Username));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Email", objUser.Email));
             break;
         case "CommonLibrary.Security.Roles.RoleInfo":
             RoleInfo objRole = (RoleInfo)objCBO;
             objLogInfo.LogProperties.Add(new LogDetailInfo("RoleID", objRole.RoleID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("RoleName", objRole.RoleName));
             objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objRole.PortalID.ToString()));
             objLogInfo.LogProperties.Add(new LogDetailInfo("Description", objRole.Description));
             objLogInfo.LogProperties.Add(new LogDetailInfo("IsPublic", objRole.IsPublic.ToString()));
             break;
         default:
             objLogInfo.LogProperties.Add(new LogDetailInfo("logdetail", XmlUtils.Serialize(objCBO)));
             break;
     }
     objLogController.AddLog(objLogInfo);
 }
 public void AddLog(LogInfo objEventLogInfo)
 {
     LogController objLogController = new LogController();
     objLogController.AddLog(objEventLogInfo);
 }
 public void AddLog(LogProperties objProperties, PortalSettings _PortalSettings, int UserID, string LogTypeKey, bool BypassBuffering)
 {
     LogController objLogController = new LogController();
     LogInfo objLogInfo = new LogInfo();
     objLogInfo.LogUserID = UserID;
     objLogInfo.LogTypeKey = LogTypeKey;
     objLogInfo.LogProperties = objProperties;
     objLogInfo.BypassBuffering = BypassBuffering;
     if (_PortalSettings != null)
     {
         objLogInfo.LogPortalID = _PortalSettings.PortalId;
         objLogInfo.LogPortalName = _PortalSettings.PortalName;
     }
     objLogController.AddLog(objLogInfo);
 }
Пример #10
0
 public virtual object GetSingleLog(LogInfo objLogInfo, LoggingProvider.ReturnType objReturnType)
 {
     return LoggingProvider.Instance().GetSingleLog(objLogInfo, objReturnType);
 }
Пример #11
0
 public void DeleteLog(LogInfo objLogInfo)
 {
     LoggingProvider.Instance().DeleteLog(objLogInfo);
 }