/// <summary> /// Hook the shutdown event /// </summary> /// <remarks> /// On the full .NET runtime, the static constructor hooks up the /// <c>AppDomain.ProcessExit</c> and <c>AppDomain.DomainUnload</c>> events. /// These are used to shutdown the log4net system as the application exits. /// </remarks> static LoggerManager() { try { // Register the AppDomain events, note we have to do this with a // method call rather than directly here because the AppDomain // makes a LinkDemand which throws the execption during the JIT phase. RegisterAppDomainEvents(); } catch (System.Security.SecurityException) { LogLog.Debug("Security Exception (ControlAppDomain LinkDemand) while trying " + "to register Shutdown handler with the AppDomain. LoggerManager.Shutdown() " + "will not be called automatically when the AppDomain exits. It must be called " + "programmatically."); } // Dump out our assembly version into the log if debug is enabled LogLog.Debug(GetVersionInfo()); // Set the default repository selector #if NETCF s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); #else s_repositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); #endif }
/// <summary> /// Hook the shutdown event /// </summary> /// <remarks> /// On the full .NET runtime, the static constructor hooks up the /// <c>AppDomain.ProcessExit</c> and <c>AppDomain.DomainUnload</c>> events. /// These are used to shutdown the log4net system as the application exits. /// </remarks> static LoggerManager() { try { // Register the AppDomain events, note we have to do this with a // method call rather than directly here because the AppDomain // makes a LinkDemand which throws the execption during the JIT phase. RegisterAppDomainEvents(); } catch(System.Security.SecurityException) { LogLog.Debug("Security Exception (ControlAppDomain LinkDemand) while trying "+ "to register Shutdown handler with the AppDomain. LoggerManager.Shutdown() "+ "will not be called automatically when the AppDomain exits. It must be called "+ "programmatically."); } // Dump out our assembly version into the log if debug is enabled LogLog.Debug(GetVersionInfo()); // Set the default repository selector #if NETCF s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); #else s_repositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); #endif }