Пример #1
0
 public void Close()
 {
     if (_repository != null)
     {
         _repository.Shutdown();
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4NetFactory"/> class.
        /// </summary>
        /// <param name="log4NetConfigurationFile">The log4 net configuration file to load and watch. If not found configures from App.Config.</param>
        public Log4NetFactory(string log4NetConfigurationFile)
        {
#if NETSTANDARD2_0
            if (File.Exists(log4NetConfigurationFile))
            {
                log4net.Config.XmlConfigurator.ConfigureAndWatch(RootRepository, new FileInfo(log4NetConfigurationFile));
            }
            else
            {
                log4net.Config.XmlConfigurator.Configure(RootRepository);
            }
#else
            //Restart logging if necessary
            log4net.Repository.ILoggerRepository rootRepository = log4net.LogManager.GetRepository();
            if (rootRepository != null)
            {
                rootRepository.Shutdown();
            }

            if (File.Exists(log4NetConfigurationFile))
            {
                log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(log4NetConfigurationFile));
            }
            else
            {
                log4net.Config.XmlConfigurator.Configure();
            }
#endif
        }
Пример #3
0
        /// <summary>
        /// Shutdowns the logging Subsystem.
        /// </summary>
        public static void Shutdown()
        {
            log4net.Repository.ILoggerRepository repository = LogManager.GetRepository();

            if (repository != null)
            {
                repository.Shutdown();
            }

            LogManager.Shutdown();
        }
Пример #4
0
 public void Dispose()
 {
     repository.Shutdown();
 }