Пример #1
0
        /// <summary>
        /// Protects from NLog.Config.SimpleConfigurator from others assemblies.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onCfgLoggerChanged(object sender, LoggingConfigurationChangedEventArgs e)
        {
            fixLoggerCfg(e.ActivatedConfiguration /*NLog PR#1897: OldConfiguration*/);   // if we're at the point after first initialization
            fixLoggerCfg(e.DeactivatedConfiguration /*NLog PR#1897: NewConfiguration*/); // if this was raised from others

            initLoggerCfg();                                                             // we also should be ready to SimpleConfigurator from other assemblies etc.
        }
Пример #2
0
        /// <summary>
        /// Invoke the Changed event; called whenever list changes
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected virtual void OnConfigurationChanged(LoggingConfigurationChangedEventArgs e)
        {
            var changed = this.ConfigurationChanged;

            if (changed != null)
            {
                changed(this, e);
            }
        }
Пример #3
0
        /// <summary>
        ///     Event handler. Called by LogManager for configuration changed
        ///     events.
        /// </summary>
        /// <param name="sender">
        ///     Source of the event.
        /// </param>
        /// <param name="e">
        ///     Logging configuration changed event information.
        /// </param>
        private void LogManager_ConfigurationChanged(
            object sender,
            LoggingConfigurationChangedEventArgs e)
        {
            if (e.NewConfiguration == this.Configuration)
            {
                return;
            }

            this.Configuration = e.NewConfiguration;

            this.UpdateConfiguration();
        }
Пример #4
0
        private static void OnConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs e)
        {
            if ((sender == null) || (e == null))
            {
                LogNullError(nameof(sender) + " || " + nameof(e));
                return;
            }

            InitConsoleLoggers();

            if (IsWaitingForUserInput)
            {
                OnUserInputStart();
            }
        }
 private void LogFactory_ConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs e)
 {
     if (ReferenceEquals(e.DeactivatedConfiguration, this))
     {
         if (_autoReload)
         {
             _autoReload = false; // Cannot unsubscribe to reload event, but we can stop reacting to it
             LogFactory.ConfigurationChanged -= LogFactory_ConfigurationChanged;
         }
     }
     else if (ReferenceEquals(e.ActivatedConfiguration, this) && _autoReload && _reloadConfiguration != null)
     {
         // Setup reload notification
         LogFactory.ConfigurationChanged += LogFactory_ConfigurationChanged;
         MonitorForReload(_originalConfigSection);
     }
 }
Пример #6
0
        private static void OnConfigurationChanged(object?sender, LoggingConfigurationChangedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            InitConsoleLoggers();

            if (IsWaitingForUserInput)
            {
                OnUserInputStart();
            }

            HistoryTarget?historyTarget = LogManager.Configuration.AllTargets.OfType <HistoryTarget>().FirstOrDefault();

            ArchiKestrel.OnNewHistoryTarget(historyTarget);
        }
Пример #7
0
        private static void OnConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs e)
        {
            if ((sender == null) || (e == null))
            {
                ASF.ArchiLogger.LogNullError(nameof(sender) + " || " + nameof(e));
                return;
            }

            InitConsoleLoggers();

            if (IsWaitingForUserInput)
            {
                OnUserInputStart();
            }

            HistoryTarget historyTarget = LogManager.Configuration.AllTargets.OfType <HistoryTarget>().FirstOrDefault();

            IPC.OnNewHistoryTarget(historyTarget);
        }
Пример #8
0
 /// <summary>
 /// Protects from NLog.Config.SimpleConfigurator from others assemblies.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void onCfgLoggerChanged(object sender, LoggingConfigurationChangedEventArgs e)
 {
     fixLoggerCfg(e.OldConfiguration); // if we are in point after first initialization
     fixLoggerCfg(e.NewConfiguration); // if this is raised from others
     initLoggerCfg();                  // we also should be ready to SimpleConfigurator from other assemblies etc.
 }
Пример #9
0
 protected virtual void OnConfigurationChanged(LoggingConfigurationChangedEventArgs e)
 {
     ConfigurationChanged?.Invoke(this, e);
 }
Пример #10
0
 private static void OnConfigChanged(object sender, LoggingConfigurationChangedEventArgs e)
 {
 }
Пример #11
0
 private void LogManager_ConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs e)
 {
     LogManager.ReconfigExistingLoggers();
 }
Пример #12
0
 private static void LogManager_ConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs e)
 {
     ExtendLogConfigurationWithTableTarget();
     Logger.Info("Logger configuration changed.");
 }