当前位置: 首页>>代码示例>>C#>>正文


C# EventLog.LogInfo类代码示例

本文整理汇总了C#中DotNetNuke.Services.Log.EventLog.LogInfo的典型用法代码示例。如果您正苦于以下问题:C# LogInfo类的具体用法?C# LogInfo怎么用?C# LogInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogInfo类属于DotNetNuke.Services.Log.EventLog命名空间,在下文中一共展示了LogInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Log404

        /// <summary>
        /// Logs the 404 error to a table for later checking 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="settings"></param>
        /// <param name="result"></param>
        public static void Log404(HttpRequest request, FriendlyUrlSettings settings, UrlAction result)
        {
            var controller = new LogController();
            var log = new LogInfo
                {
                    LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                    LogPortalID = (result.PortalAlias != null) ? result.PortalId : -1
                };
            log.LogProperties.Add(new LogDetailInfo("TabId", (result.TabId > 0) ? result.TabId.ToString() : String.Empty));
            log.LogProperties.Add(new LogDetailInfo("PortalAlias",  (result.PortalAlias != null) ? result.PortalAlias.HTTPAlias : String.Empty));
            log.LogProperties.Add(new LogDetailInfo("OriginalUrl",  result.RawUrl));

            if (request != null)
            {
                if (request.UrlReferrer != null)
                {
                    log.LogProperties.Add(new LogDetailInfo("Referer", request.UrlReferrer.AbsoluteUri));
                }
                log.LogProperties.Add(new LogDetailInfo("Url", request.Url.AbsoluteUri));
                log.LogProperties.Add(new LogDetailInfo("UserAgent", request.UserAgent));
                log.LogProperties.Add(new LogDetailInfo("HostAddress", request.UserHostAddress));
                log.LogProperties.Add(new LogDetailInfo("HostName", request.UserHostName));
            }

            controller.AddLog(log);
        }
开发者ID:uXchange,项目名称:Dnn.Platform,代码行数:32,代码来源:UrlRewriterUtils.cs

示例2: GetLogDetails

        public HttpResponseMessage GetLogDetails(string guid)
        {
            Guid logId;
            if (string.IsNullOrEmpty(guid) || !Guid.TryParse(guid, out logId))
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            try
            {
                var logInfo = new LogInfo {LogGUID = guid};
                logInfo = EventLogController.Instance.GetSingleLog(logInfo, LoggingProvider.ReturnType.LogInfoObjects) as LogInfo;
                if (logInfo == null)
                {
                    return Request.CreateResponse(HttpStatusCode.BadRequest);
                }

                return Request.CreateResponse(HttpStatusCode.OK, new
                                                                     {
                                                                         Title = Localization.GetSafeJSString("CriticalError.Error", Localization.SharedResourceFile),
                                                                         Content = GetPropertiesText(logInfo)
                                                                     });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:29,代码来源:EventLogServiceController.cs

示例3: UpgradeModule

        private static void UpgradeModule(EventMessage message)
        {
            try
            {
                int desktopModuleId = Convert.ToInt32(message.Attributes["DesktopModuleId"]);
                var desktopModule = DesktopModuleController.GetDesktopModule(desktopModuleId, Null.NullInteger);

                string BusinessControllerClass = message.Attributes["BusinessControllerClass"];
                object controller = Reflection.CreateObject(BusinessControllerClass, "");
                if (controller is IUpgradeable)
                {
					//get the list of applicable versions
                    string[] UpgradeVersions = message.Attributes["UpgradeVersionsList"].Split(',');
                    foreach (string Version in UpgradeVersions)
                    {
						//call the IUpgradeable interface for the module/version
                        string Results = ((IUpgradeable) controller).UpgradeModule(Version);
                        //log the upgrade results
                        var log = new LogInfo {LogTypeKey = EventLogController.EventLogType.MODULE_UPDATED.ToString()};
                        log.AddProperty("Module Upgraded", BusinessControllerClass);
                        log.AddProperty("Version", Version);
                        if (!string.IsNullOrEmpty(Results))
                        {
                            log.AddProperty("Results", Results);
                        }
                        LogController.Instance.AddLog(log);
                    }
                }
                UpdateSupportedFeatures(controller, Convert.ToInt32(message.Attributes["DesktopModuleId"]));
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:35,代码来源:EventMessageProcessor.cs

示例4: GetProperties

 private static Dictionary<string, string> GetProperties(LogInfo logInfo)
 {
     var prop = new Dictionary<string, string>();
     prop.AddIfNotNull("TypeKey", logInfo.LogTypeKey);
     prop.AddIfNotNull("ConfigID", logInfo.LogConfigID);
     prop.AddIfNotNull("FileID", logInfo.LogFileID);
     prop.AddIfNotNull("GUID", logInfo.LogGUID);
     prop.AddIfNotNull("PortalName", logInfo.LogPortalName);
     prop.AddIfNotNull("ServerName", logInfo.LogServerName);
     prop.AddIfNotNull("UserName", logInfo.LogUserName);
     prop.Add("CreateDate", logInfo.LogCreateDate.ToString(CultureInfo.InvariantCulture));
     prop.Add("EventID", logInfo.LogEventID.ToString());
     prop.Add("PortalID", logInfo.LogPortalID.ToString());
     prop.Add("UserID", logInfo.LogUserID.ToString());
     prop.AddIfNotNull("Exception.Message", logInfo.Exception.Message);
     prop.AddIfNotNull("Exception.Source", logInfo.Exception.Source);
     prop.AddIfNotNull("Exception.StackTrace", logInfo.Exception.StackTrace);
     prop.AddIfNotNull("Exception.InnerMessage", logInfo.Exception.InnerMessage);
     prop.AddIfNotNull("Exception.InnerStackTrace", logInfo.Exception.InnerStackTrace);
     if (logInfo.LogProperties != null)
     {
         prop.AddIfNotNull("Summary", logInfo.LogProperties.Summary);
         foreach (LogDetailInfo logProperty in logInfo.LogProperties)
         {
             prop.Add(logProperty.PropertyName, logProperty.PropertyValue);
         }
     }
     return prop;
 } 
开发者ID:davidjrh,项目名称:dnn.appinsights,代码行数:29,代码来源:AppInsightsLoggingProvider.cs

示例5: AddLog

        public void AddLog(Exception objException, ExceptionLogType LogType)
        {
            var objLogController = new LogController();
            var objLogInfo = new LogInfo();
            objLogInfo.LogTypeKey = LogType.ToString();
            if (LogType == ExceptionLogType.SEARCH_INDEXER_EXCEPTION)
            {
				//Add SearchException Properties
                var 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)
            {
				//Add ModuleLoadException Properties
                var 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)
            {
				//Add SecurityException Properties
                var objSecurityException = (SecurityException) objException;
                objLogInfo.LogProperties.Add(new LogDetailInfo("Querystring", objSecurityException.Querystring));
                objLogInfo.LogProperties.Add(new LogDetailInfo("IP", objSecurityException.IP));
            }
			
			//Add BasePortalException Properties
            var 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);
        }
开发者ID:biganth,项目名称:Curt,代码行数:58,代码来源:ExceptionLogController.cs

示例6: AddLogToFile

        private static void AddLogToFile(LogInfo logInfo)
        {
            try
            {
                var f = Globals.HostMapPath + "\\Logs\\LogFailures.xml.resources";
                WriteLog(f, logInfo.Serialize());
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch (Exception exc) // ReSharper restore EmptyGeneralCatchClause
            {
                Logger.Error(exc);

            }
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:14,代码来源:LogController.cs

示例7: AddLog

        public override void AddLog(LogInfo logInfo)
        {   
            // Add log to DNN event log         
            base.AddLog(logInfo);

            // Add log to Application Insights
            if (string.IsNullOrEmpty(AppInsightsClient.InstrumentationKey)) return;

            // Repeat base class private check 
            var logTypeConfigInfoByKey = GetLogTypeConfigInfoByKey(logInfo.LogTypeKey, (logInfo.LogPortalID != Null.NullInteger ? logInfo.LogPortalID.ToString() : "*"));
            if (logTypeConfigInfoByKey == null || !logTypeConfigInfoByKey.LoggingIsActive)
            {
                return;
            }
            logInfo.LogConfigID = logTypeConfigInfoByKey.ID;
            var message =
                $"{logInfo.LogTypeKey}{(string.IsNullOrEmpty(logInfo.LogUserName) ? string.Empty : $" Username: {logInfo.LogUserName}")}{(string.IsNullOrEmpty(logInfo.LogProperties.Summary) ? string.Empty : $" Summary: {logInfo.LogProperties.Summary}")}";
            AppInsightsClient.TrackEvent(message, GetProperties(logInfo));
        }
开发者ID:davidjrh,项目名称:dnn.appinsights,代码行数:19,代码来源:AppInsightsLoggingProvider.cs

示例8: GetPropertiesText

 private string GetPropertiesText(LogInfo logInfo)
 {
     var objLogProperties = logInfo.LogProperties;
     var str = new StringBuilder();
     int i;
     for (i = 0; i <= objLogProperties.Count - 1; i++)
     {
         //display the values in the Panel child controls.
         var ldi = (LogDetailInfo)objLogProperties[i];
         if (ldi.PropertyName == "Message")
         {
             str.Append("<p><strong>" + ldi.PropertyName + "</strong>:</br><pre>" + HttpUtility.HtmlEncode(ldi.PropertyValue) + "</pre></p>");
         }
         else
         {
             str.Append("<p><strong>" + ldi.PropertyName + "</strong>:" + HttpUtility.HtmlEncode(ldi.PropertyValue) + "</p>");
         }
     }
     str.Append("<p><b>Server Name</b>: " + HttpUtility.HtmlEncode(logInfo.LogServerName) + "</p>");
     return str.ToString();
 }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:21,代码来源:EventLogServiceController.cs

示例9: AddLog

		public void AddLog(BasePortalException objBasePortalException)
		{
			var log = new LogInfo
			{
				Exception = Exceptions.Exceptions.GetExceptionInfo(objBasePortalException),
			};
			log.Exception.AssemblyVersion = objBasePortalException.AssemblyVersion;
			log.Exception.PortalId = objBasePortalException.PortalID;
			log.Exception.UserId = objBasePortalException.UserID;
			log.Exception.TabId = objBasePortalException.ActiveTabID;
			log.Exception.RawUrl = objBasePortalException.RawURL;
			log.Exception.Referrer = objBasePortalException.AbsoluteURLReferrer;
			log.Exception.UserAgent = objBasePortalException.UserAgent;
			if (objBasePortalException.GetType().Name == "ModuleLoadException")
			{
				AddLog(objBasePortalException, log, ExceptionLogType.MODULE_LOAD_EXCEPTION);
			}
			else if (objBasePortalException.GetType().Name == "PageLoadException")
			{
				AddLog(objBasePortalException, log, ExceptionLogType.PAGE_LOAD_EXCEPTION);
			}
			else if (objBasePortalException.GetType().Name == "SchedulerException")
			{
				AddLog(objBasePortalException, log, ExceptionLogType.SCHEDULER_EXCEPTION);
			}
			else if (objBasePortalException.GetType().Name == "SecurityException")
			{
				AddLog(objBasePortalException, log, ExceptionLogType.SECURITY_EXCEPTION);
			}
			else if (objBasePortalException.GetType().Name == "SearchException")
			{
				AddLog(objBasePortalException, log, ExceptionLogType.SEARCH_INDEXER_EXCEPTION);
			}
			else
			{
				AddLog(objBasePortalException, log, ExceptionLogType.GENERAL_EXCEPTION);
			}
		}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:38,代码来源:ExceptionLogController.cs

示例10: LogResult

        private void LogResult(string message)
        {
            var portalSecurity = new PortalSecurity();

			var log = new LogInfo
            {
                LogPortalID = PortalSettings.PortalId,
                LogPortalName = PortalSettings.PortalName,
                LogUserID = UserId,
                LogUserName = portalSecurity.InputFilter(txtUsername.Text, PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets | PortalSecurity.FilterFlag.NoMarkup)
            };
			
            if (string.IsNullOrEmpty(message))
            {
                log.LogTypeKey = "PASSWORD_SENT_SUCCESS";
            }
            else
            {
                log.LogTypeKey = "PASSWORD_SENT_FAILURE";
                log.LogProperties.Add(new LogDetailInfo("Cause", message));
            }
            
			log.AddProperty("IP", _ipAddress);
            
            LogController.Instance.AddLog(log);

        }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:27,代码来源:SendPassword.ascx.cs

示例11: LogModuleProviderExceptionInRequest

        /// <summary>
        /// logs an exception related to a module provider once per cache-lifetime
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="status"></param>
        /// <param name="result"></param>
        /// <param name="messages"></param>
        /// <param name="provider"></param>
        public static void LogModuleProviderExceptionInRequest(Exception ex, string status,
                                                                ExtensionUrlProvider provider, 
                                                                UrlAction result,
                                                                List<string> messages)
        {
            if (ex != null)
            {
                string moduleProviderName = "Unknown Provider";
                string moduleProviderVersion = "Unknown Version";
                if (provider != null)
                {
                    moduleProviderName = provider.ProviderConfig.ProviderName;
                    moduleProviderVersion = provider.GetType().Assembly.GetName(false).Version.ToString();
                }
                //this logic prevents a site logging an exception for every request made.  Instead 
                //the exception will be logged once for the life of the cache / application restart or 1 hour, whichever is shorter.
                //create a cache key for this exception type
                string cacheKey = ex.GetType().ToString();
                //see if there is an existing object logged for this exception type
                object existingEx = DataCache.GetCache(cacheKey);
                if (existingEx == null)
                {
                    //if there was no existing object logged for this exception type, this is a new exception
                    DateTime expire = DateTime.Now.AddHours(1);
                    DataCache.SetCache(cacheKey, cacheKey, expire);
                    //just store the cache key - it doesn't really matter
                    //create a log event
                    string productVer = Assembly.GetExecutingAssembly().GetName(false).Version.ToString();
                    var elc = new EventLogController();
                    var logEntry = new LogInfo {LogTypeKey = "GENERAL_EXCEPTION"};
                    logEntry.AddProperty("Url Rewriting Extension Url Provider Exception",
                                         "Exception in Url Rewriting Process");
                    logEntry.AddProperty("Provider Name", moduleProviderName);
                    logEntry.AddProperty("Provider Version", moduleProviderVersion);
                    logEntry.AddProperty("Http Status", status);
                    logEntry.AddProperty("Product Version", productVer);
                    if (result != null)
                    {
                        logEntry.AddProperty("Original Path", result.OriginalPath ?? "null");
                        logEntry.AddProperty("Raw Url", result.RawUrl ?? "null");
                        logEntry.AddProperty("Final Url", result.FinalUrl ?? "null");

                        logEntry.AddProperty("Rewrite Result", !string.IsNullOrEmpty(result.RewritePath)
                                                                     ? result.RewritePath
                                                                     : "[no rewrite]");
                        logEntry.AddProperty("Redirect Location", string.IsNullOrEmpty(result.FinalUrl) 
                                                                    ? "[no redirect]" 
                                                                    : result.FinalUrl);
                        logEntry.AddProperty("Action", result.Action.ToString());
                        logEntry.AddProperty("Reason", result.Reason.ToString());
                        logEntry.AddProperty("Portal Id", result.PortalId.ToString());
                        logEntry.AddProperty("Tab Id", result.TabId.ToString());
                        logEntry.AddProperty("Http Alias", result.PortalAlias != null ? result.PortalAlias.HTTPAlias : "Null");

                        if (result.DebugMessages != null)
                        {
                            int i = 1;
                            foreach (string debugMessage in result.DebugMessages)
                            {
                                string msg = debugMessage;
                                if (debugMessage == null)
                                {
                                    msg = "[message was null]";
                                }
                                logEntry.AddProperty("Debug Message[result] " + i.ToString(), msg);
                                i++;
                            }
                        }
                    }
                    else
                    {
                        logEntry.AddProperty("Result", "Result value null");
                    }
                    if (messages != null)
                    {
                        int i = 1;
                        foreach (string msg in messages)
                        {
                            logEntry.AddProperty("Debug Message[raw] " + i.ToString(), msg);
                            i++;
                        }
                    }
                    logEntry.AddProperty("Exception Type", ex.GetType().ToString());
                    logEntry.AddProperty("Message", ex.Message);
                    logEntry.AddProperty("Stack Trace", ex.StackTrace);
                    if (ex.InnerException != null)
                    {
                        logEntry.AddProperty("Inner Exception Message", ex.InnerException.Message);
                        logEntry.AddProperty("Inner Exception Stacktrace", ex.InnerException.StackTrace);
                    }
                    logEntry.BypassBuffering = true;
                    elc.AddLog(logEntry);
//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:101,代码来源:ExtensionUrlProviderController.cs

示例12: OnPreRequestHandlerExecute

        private void OnPreRequestHandlerExecute(object sender, EventArgs e)
        {
            try
            {
                //First check if we are upgrading/installing or if it is a non-page request
                var app = (HttpApplication) sender;
                HttpRequest request = app.Request;

                //First check if we are upgrading/installing
                if (request.Url.LocalPath.ToLower().EndsWith("install.aspx")
                        || request.Url.LocalPath.ToLower().Contains("upgradewizard.aspx")
                        || request.Url.LocalPath.ToLower().Contains("installwizard.aspx"))
                {
                    return;
                }
				
                //exit if a request for a .net mapping that isn't a content page is made i.e. axd
                if (request.Url.LocalPath.ToLower().EndsWith(".aspx") == false && request.Url.LocalPath.ToLower().EndsWith(".asmx") == false &&
                    request.Url.LocalPath.ToLower().EndsWith(".ashx") == false)
                {
                    return;
                }
                if (HttpContext.Current != null)
                {
                    HttpContext context = HttpContext.Current;
                    if ((context == null))
                    {
                        return;
                    }
                    var page = context.Handler as CDefault;
                    if ((page == null))
                    {
                        return;
                    }
                    page.Load += OnPageLoad;
                }
            }
            catch (Exception ex)
            {
                var objEventLog = new EventLogController();
                var objEventLogInfo = new LogInfo();
                objEventLogInfo.AddProperty("Analytics.AnalyticsModule", "OnPreRequestHandlerExecute");
                objEventLogInfo.AddProperty("ExceptionMessage", ex.Message);
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLog.AddLog(objEventLogInfo);
                Logger.Error(objEventLogInfo);

            }
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:49,代码来源:AnalyticsModule.cs

示例13: UploadLegacySkin


//.........这里部分代码省略.........
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadLegacySkin(rootPath, RootSkin, skinName, objMemoryStream);
                        }
                        else if (objZipEntry.Name.ToLower() == RootContainer.ToLower() + ".zip")
                        {
                            var objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadLegacySkin(rootPath, RootContainer, skinName, objMemoryStream);
                        }
                        else
                        {
                            strFileName = rootPath + skinRoot + "\\" + skinName + "\\" + objZipEntry.Name;

                            //create the directory if it does not exist
                            if (!Directory.Exists(Path.GetDirectoryName(strFileName)))
                            {
                                strMessage += FormatMessage(CREATE_DIR, Path.GetDirectoryName(strFileName), 2, false);
                                Directory.CreateDirectory(Path.GetDirectoryName(strFileName));
                            }
							
							//remove the old file
                            if (File.Exists(strFileName))
                            {
                                File.SetAttributes(strFileName, FileAttributes.Normal);
                                File.Delete(strFileName);
                            }
							
							//create the new file
                            objFileStream = File.Create(strFileName);
							
							//unzip the file
                            strMessage += FormatMessage(WRITE_FILE, Path.GetFileName(strFileName), 2, false);
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objFileStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objFileStream.Close();

                            //save the skin file
                            switch (Path.GetExtension(strFileName))
                            {
                                case ".htm":
                                case ".html":
                                case ".ascx":
                                case ".css":
                                    if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                    {
                                        arrSkinFiles.Add(strFileName);
                                    }
                                    break;
                            }
                            break;
                        }
                    }
                    else
                    {
                        strMessage += string.Format(FILE_RESTICTED, objZipEntry.Name, Host.AllowedExtensionWhitelist.ToStorageString(), ",", ", *.").Replace("2", "true");
                    }
                }
                objZipEntry = objZipInputStream.GetNextEntry();
            }
            strMessage += FormatMessage(END_MESSAGE, skinName + ".zip", 1, false);
            objZipInputStream.Close();

            //process the list of skin files
            var NewSkin = new SkinFileProcessor(rootPath, skinRoot, skinName);
            strMessage += NewSkin.ProcessList(arrSkinFiles, SkinParser.Portable);
			
			//log installation event
            try
            {
                var objEventLogInfo = new LogInfo();
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLogInfo.LogProperties.Add(new LogDetailInfo("Install Skin:", skinName));
                Array arrMessage = strMessage.Split(new[] {"<br />"}, StringSplitOptions.None);
                foreach (string strRow in arrMessage)
                {
                    objEventLogInfo.LogProperties.Add(new LogDetailInfo("Info:", HtmlUtils.StripTags(strRow, true)));
                }
                var objEventLog = new EventLogController();
                objEventLog.AddLog(objEventLogInfo);
            }
            catch (Exception exc)
            {
                Logger.Error(exc);

            }
            return strMessage;
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:101,代码来源:SkinController.cs

示例14: RestartApplication

 protected virtual void RestartApplication()
 {
     var objEv = new EventLogController();
     var objEventLogInfo = new LogInfo { BypassBuffering = true, LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString() };
     objEventLogInfo.AddProperty("Message", GetString("UserRestart"));
     objEv.AddLog(objEventLogInfo);
     Config.Touch();
 }
开发者ID:biganth,项目名称:Curt,代码行数:8,代码来源:DnnRibbonBarTool.cs

示例15: OnPageLoad

        private void OnPageLoad(object sender, EventArgs e)
        {
            try
            {
                AnalyticsEngineCollection analyticsEngines = AnalyticsEngineConfiguration.GetConfig().AnalyticsEngines;
                if (analyticsEngines == null || analyticsEngines.Count == 0)
                {
                    return;
                }
                var page = (Page) sender;
                if ((page == null))
                {
                    return;
                }
                foreach (AnalyticsEngine engine in analyticsEngines)
                {
                    if ((!String.IsNullOrEmpty(engine.ElementId)))
                    {
                        AnalyticsEngineBase objEngine = null;
                        if ((!String.IsNullOrEmpty(engine.EngineType)))
                        {
                            Type engineType = Type.GetType(engine.EngineType);
                            if (engineType == null) 
                                objEngine = new GenericAnalyticsEngine();
                            else
                                objEngine = (AnalyticsEngineBase) Activator.CreateInstance(engineType);
                        }
                        else
                        {
                            objEngine = new GenericAnalyticsEngine();
                        }
                        if (objEngine != null)
                        {
                            string script = engine.ScriptTemplate;
                            if ((!String.IsNullOrEmpty(script)))
                            {
                                script = objEngine.RenderScript(script);
                                if ((!String.IsNullOrEmpty(script)))
                                {
                                    var element = (HtmlContainerControl) page.FindControl(engine.ElementId);
                                    if (element != null)
                                    {
                                        var scriptControl = new LiteralControl();
                                        scriptControl.Text = script;
                                        if (engine.InjectTop)
                                        {
                                            element.Controls.AddAt(0, scriptControl);
                                        }
                                        else
                                        {
                                            element.Controls.Add(scriptControl);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var objEventLog = new EventLogController();
                var objEventLogInfo = new LogInfo();
                objEventLogInfo.AddProperty("Analytics.AnalyticsModule", "OnPageLoad");
                objEventLogInfo.AddProperty("ExceptionMessage", ex.Message);
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLog.AddLog(objEventLogInfo);
                Logger.Error(ex);

            }
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:71,代码来源:AnalyticsModule.cs


注:本文中的DotNetNuke.Services.Log.EventLog.LogInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。