Defines a message rate for the message suppression algorithm
Esempio n. 1
0
        static Logger()
        {
            //Initializes the empty object of StackTraceDetails
            LogStackTrace.Initialize();
            LogStackMessages.Initialize();
            GrowStackDisposal(1);

            s_logger   = new LoggerInternal(out s_logger);
            Console    = new LogSubscriptionConsole();
            FileWriter = new LogSubscriptionFileWriter(1000);

            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
            AppDomain.CurrentDomain.UnhandledException   += CurrentDomain_UnhandledException;

            Log = CreatePublisher(typeof(Logger), MessageClass.Component);
            Log.InitialStackTrace     = LogStackTrace.Empty;
            EventFirstChanceException = Log.RegisterEvent(MessageLevel.NA, MessageFlags.SystemHealth, "First Chance App Domain Exception", 30, MessageRate.PerSecond(30), 1000);
            EventAppDomainException   = Log.RegisterEvent(MessageLevel.Critical, MessageFlags.SystemHealth, "Unhandled App Domain Exception");
            EventSwallowedException   = Log.RegisterEvent(MessageLevel.Debug, MessageFlags.None, "Exception was Swallowed", 30, MessageRate.PerSecond(30), 1000);

            ShutdownHandler.Initialize();
        }
Esempio n. 2
0
 public Monitor(int delay)
 {
     m_logSmall  = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"ThreadPool Small Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logMedium = Log.RegisterEvent(MessageLevel.Warning, MessageFlags.SystemHealth, $"ThreadPool Medium Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logLarge  = Log.RegisterEvent(MessageLevel.Error, MessageFlags.SystemHealth, $"ThreadPool Large Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logSmall.ShouldRaiseMessageSupressionNotifications  = false;
     m_logMedium.ShouldRaiseMessageSupressionNotifications = false;
     m_logLarge.ShouldRaiseMessageSupressionNotifications  = false;
     m_delay         = delay;
     m_time          = null;
     m_task          = new ScheduledTask();
     m_task.Running += task_Running;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes an <see cref="LogEventPublisher"/> with a series of settings.
 /// </summary>
 /// <param name="attributes"></param>
 /// <param name="eventName"></param>
 /// <param name="stackTraceDepth"></param>
 /// <param name="messagesPerSecond"></param>
 /// <param name="burstLimit"></param>
 /// <returns></returns>
 private LogEventPublisherInternal InternalRegisterEvent(LogMessageAttributes attributes, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit)
 {
     if (eventName == null)
         eventName = string.Empty;
     LogEventPublisherInternal publisher;
     if (m_lookupEventPublishers.TryGetValue(Tuple.Create(attributes, eventName), out publisher))
     {
         return publisher;
     }
     return InternalRegisterNewEvent(attributes, eventName, stackTraceDepth, messagesPerSecond, burstLimit);
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes an <see cref="LogEventPublisher"/> with the provided values.
 /// </summary>
 /// <param name="level">the level of the message</param>
 /// <param name="flags">associated flags</param>
 /// <param name="eventName"></param>
 /// <param name="stackTraceDepth"></param>
 /// <param name="messagesPerSecond"></param>
 /// <param name="burstLimit"></param>
 /// <returns></returns>
 public LogEventPublisher RegisterEvent(MessageLevel level, MessageFlags flags, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit)
 {
     LogMessageAttributes flag = new LogMessageAttributes(m_classification, level, MessageSuppression.None, flags);
     LogEventPublisherInternal publisher = InternalRegisterEvent(flag, eventName, stackTraceDepth, messagesPerSecond, burstLimit);
     return new LogEventPublisher(this, publisher);
 }
Esempio n. 5
0
        /// <summary>
        /// Initializes an <see cref="LogEventPublisher"/> with a series of settings.
        /// </summary>
        /// <param name="attributes"></param>
        /// <param name="eventName"></param>
        /// <param name="stackTraceDepth"></param>
        /// <param name="messagesPerSecond"></param>
        /// <param name="burstLimit"></param>
        /// <returns></returns>
        private LogEventPublisherInternal InternalRegisterEvent(LogMessageAttributes attributes, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit)
        {
            if (eventName == null)
            {
                eventName = string.Empty;
            }
            LogEventPublisherInternal publisher;

            if (m_lookupEventPublishers.TryGetValue(Tuple.Create(attributes, eventName), out publisher))
            {
                return(publisher);
            }
            return(InternalRegisterNewEvent(attributes, eventName, stackTraceDepth, messagesPerSecond, burstLimit));
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes an <see cref="LogEventPublisher"/> with the provided values.
        /// </summary>
        /// <param name="level">the level of the message</param>
        /// <param name="flags">associated flags</param>
        /// <param name="eventName"></param>
        /// <param name="stackTraceDepth"></param>
        /// <param name="messagesPerSecond"></param>
        /// <param name="burstLimit"></param>
        /// <returns></returns>
        public LogEventPublisher RegisterEvent(MessageLevel level, MessageFlags flags, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit)
        {
            LogMessageAttributes      flag      = new LogMessageAttributes(m_classification, level, MessageSuppression.None, flags);
            LogEventPublisherInternal publisher = InternalRegisterEvent(flag, eventName, stackTraceDepth, messagesPerSecond, burstLimit);

            return(new LogEventPublisher(this, publisher));
        }