internal static ErrorLog GetDefaultImpl(HttpContext context) { ErrorLog log; if (context != null) { log = (ErrorLog)context.Items[_contextKey]; if (log != null) { return(log); } } // // Determine the default store type from the configuration and // create an instance of it. // log = (ErrorLog)SimpleServiceProviderFactory.CreateFromConfigSection(Configuration.GroupSlash + "errorLog"); // // If no object got created (probably because the right // configuration settings are missing) then default to // the in-memory log implementation. // if (log == null) { log = new MemoryErrorLog(); } if (context != null) { // // Infer the application name from the context if it has not // been initialized so far. // if (log.ApplicationName.Length == 0) { log.ApplicationName = InferApplicationName(context); } // // Save into the context if context is there so retrieval is // quick next time. // context.Items[_contextKey] = log; } return(log); }
/// <summary> /// Gets the default error log implementation specified in the /// configuration file, or the in-memory log implemention if /// none is configured. /// </summary> public static ErrorLog GetDefault(HttpContext context) { ErrorLog log; if (context != null) { log = (ErrorLog) context.Items[_contextKey]; if (log != null) return log; } // // Determine the default store type from the configuration and // create an instance of it. // log = (ErrorLog) SimpleServiceProviderFactory.CreateFromConfigSection(Configuration.GroupSlash + "errorLog"); // // If no object got created (probably because the right // configuration settings are missing) then default to // the in-memory log implementation. // if (log == null) log = new MemoryErrorLog(); if (context != null) { // // Infer the application name from the context if it has not // been initialized so far. // if (log.ApplicationName.Length == 0) log.ApplicationName = InferApplicationName(context); // // Save into the context if context is there so retrieval is // quick next time. // context.Items[_contextKey] = log; } return log; }