示例#1
0
        /// <summary>
        /// Setups the logger with the <see cref="BufferedSumoLogicAppender"/> based on the given settings.
        /// </summary>
        /// <param name="messagesPerRequest">The maximum messages per request.</param>
        /// <param name="maxFlushInterval">The maximum flush interval, in milliseconds.</param>
        /// <param name="flushingAccuracy">The flushing accuracy, in milliseconds.</param>
        /// <param name="retryInterval">The retry interval, in milliseconds.</param>
        private void SetUpLogger(long messagesPerRequest, long maxFlushInterval, long flushingAccuracy, long retryInterval = 10000)
        {
            messagesHandler = new MockHttpMessageHandler();

            bufferedSumoLogicAppender                    = new BufferedSumoLogicAppender(null, messagesHandler);
            bufferedSumoLogicAppender.Url                = "http://www.fakeadress.com";
            bufferedSumoLogicAppender.SourceName         = "BufferedSumoLogicAppenderSourceName";
            bufferedSumoLogicAppender.SourceCategory     = "BufferedSumoLogicAppenderSourceCategory";
            bufferedSumoLogicAppender.SourceHost         = "BufferedSumoLogicAppenderSourceHost";
            bufferedSumoLogicAppender.MessagesPerRequest = messagesPerRequest;
            bufferedSumoLogicAppender.MaxFlushInterval   = maxFlushInterval;
            bufferedSumoLogicAppender.FlushingAccuracy   = flushingAccuracy;
            bufferedSumoLogicAppender.RetryInterval      = retryInterval;
            bufferedSumoLogicAppender.Layout             = new PatternLayout("%m%n");
            bufferedSumoLogicAppender.UseConsoleLog      = true;
            bufferedSumoLogicAppender.ActivateOptions();

            log4netLog               = LogManager.GetLogger(typeof(BufferedSumoLogicAppenderTest));
            log4netLogger            = (Logger)log4netLog.Logger;
            log4netLogger.Additivity = false;
            log4netLogger.Level      = Level.All;
            log4netLogger.RemoveAllAppenders();
            log4netLogger.AddAppender(bufferedSumoLogicAppender);
            log4netLogger.Repository.Configured = true;
        }
        /// <summary>
        /// Setups the logger with the <see cref="BufferedSumoLogicAppender"/> based on the given settings.
        /// </summary>
        /// <param name="messagesPerRequest">The maximum messages per request.</param>
        /// <param name="maxFlushInterval">The maximum flush interval, in milliseconds.</param>
        /// <param name="flushingAccuracy">The flushing accuracy, in milliseconds.</param>
        /// <param name="retryInterval">The retry interval, in milliseconds.</param>
        private void SetUpLogger(long messagesPerRequest, long maxFlushInterval, long flushingAccuracy, long retryInterval = 10000)
        {
            this.messagesHandler = new MockHttpMessageHandler();

            this.bufferedSumoLogicAppender     = new BufferedSumoLogicAppender(null, this.messagesHandler);
            this.bufferedSumoLogicAppender.Url = "http://www.fakeadress.com";
            this.bufferedSumoLogicAppender.MessagesPerRequest = messagesPerRequest;
            this.bufferedSumoLogicAppender.MaxFlushInterval   = maxFlushInterval;
            this.bufferedSumoLogicAppender.FlushingAccuracy   = flushingAccuracy;
            this.bufferedSumoLogicAppender.RetryInterval      = retryInterval;
            this.bufferedSumoLogicAppender.Layout             = new PatternLayout("%m%n");
            this.bufferedSumoLogicAppender.ActivateOptions();

            this.log4netLog               = LogManager.GetLogger(typeof(BufferedSumoLogicAppenderTest));
            this.log4netLogger            = this.log4netLog.Logger as Logger;
            this.log4netLogger.Additivity = false;
            this.log4netLogger.Level      = Level.All;
            this.log4netLogger.RemoveAllAppenders();
            this.log4netLogger.AddAppender(this.bufferedSumoLogicAppender);
            this.log4netLogger.Repository.Configured = true;
        }
        /// <summary>
        /// Setups the logger with the <see cref="BufferedSumoLogicAppender"/> based on the given settings.
        /// </summary>
        /// <param name="messagesPerRequest">The maximum messages per request.</param>
        /// <param name="maxFlushInterval">The maximum flush interval, in milliseconds.</param>
        /// <param name="flushingAccuracy">The flushing accuracy, in milliseconds.</param>
        /// <param name="retryInterval">The retry interval, in milliseconds.</param>
        private void SetUpLogger(long messagesPerRequest, long maxFlushInterval, long flushingAccuracy, long retryInterval = 10000)
        {
            this.messagesHandler = new MockHttpMessageHandler();

            this.bufferedSumoLogicAppender = new BufferedSumoLogicAppender(null, this.messagesHandler);
            this.bufferedSumoLogicAppender.Url = "http://www.fakeadress.com";
            this.bufferedSumoLogicAppender.MessagesPerRequest = messagesPerRequest;
            this.bufferedSumoLogicAppender.MaxFlushInterval = maxFlushInterval;
            this.bufferedSumoLogicAppender.FlushingAccuracy = flushingAccuracy;
            this.bufferedSumoLogicAppender.RetryInterval = retryInterval;
            this.bufferedSumoLogicAppender.Layout = new PatternLayout("%m%n");
            this.bufferedSumoLogicAppender.ActivateOptions();

            this.log4netLog = LogManager.GetLogger(typeof(BufferedSumoLogicAppenderTest));
            this.log4netLogger = this.log4netLog.Logger as Logger;
            this.log4netLogger.Additivity = false;
            this.log4netLogger.Level = Level.All;
            this.log4netLogger.RemoveAllAppenders();
            this.log4netLogger.AddAppender(this.bufferedSumoLogicAppender);
            this.log4netLogger.Repository.Configured = true;
        }