static LoggerManager()

in src/log4net/Core/LoggerManager.cs [82:151]


		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 exception during the JIT phase.
				RegisterAppDomainEvents();
			}
			catch(System.Security.SecurityException)
			{
				LogLog.Debug(declaringType, "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(declaringType, GetVersionInfo());

			// Set the default repository selector
#if NETCF
			s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy));
			return;
#elif !NETSTANDARD1_3
			// Look for the RepositorySelector type specified in the AppSettings 'log4net.RepositorySelector'
			string appRepositorySelectorTypeName = SystemInfo.GetAppSetting("log4net.RepositorySelector");
			if (appRepositorySelectorTypeName != null && appRepositorySelectorTypeName.Length > 0)
			{
				// Resolve the config string into a Type
				Type appRepositorySelectorType = null;
				try
				{
					appRepositorySelectorType = SystemInfo.GetTypeFromString(appRepositorySelectorTypeName, false, true);
				}
				catch(Exception ex)
				{
					LogLog.Error(declaringType, "Exception while resolving RepositorySelector Type ["+appRepositorySelectorTypeName+"]", ex);
				}

				if (appRepositorySelectorType != null)
				{
					// Create an instance of the RepositorySelectorType
					object appRepositorySelectorObj = null;
					try
					{
						appRepositorySelectorObj = Activator.CreateInstance(appRepositorySelectorType);
					}
					catch(Exception ex)
					{
						LogLog.Error(declaringType, "Exception while creating RepositorySelector ["+appRepositorySelectorType.FullName+"]", ex);
					}

					if (appRepositorySelectorObj != null && appRepositorySelectorObj is IRepositorySelector)
					{
						s_repositorySelector = (IRepositorySelector)appRepositorySelectorObj;
					}
					else
					{
						LogLog.Error(declaringType, "RepositorySelector Type ["+appRepositorySelectorType.FullName+"] is not an IRepositorySelector");
					}
				}
			}
#endif
			// Create the DefaultRepositorySelector if not configured above 
			if (s_repositorySelector == null)
			{
				s_repositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy));
			}
		}