Inheritance: log4net.Appender.AppenderSkeleton, ILogLevelThresholdSelector
Exemplo n.º 1
0
        public ILogLevelThresholdSelector AppendLogService(ILogService logService, IDictionary <string, object> additionalData = null)
        {
            if (CurrentLogger == null)
            {
                return(null);
            }

            var appenderAttachable = CurrentLogger as global::log4net.Core.IAppenderAttachable;

            if (appenderAttachable == null)
            {
                return(null);
            }

            var appender = new LogServiceAppender(logService);

            // let's examine potential parameters
            if (additionalData != null && additionalData.ContainsKey(PatternParameter))
            {
                var parameter = additionalData[PatternParameter];
                if (parameter != null && parameter is string)
                {
                    var pattern = (string)parameter;
                    appender.Layout = new global::log4net.Layout.PatternLayout(pattern);
                }
            }

            appender.LogLevelThreshold = LogLevel.All;
            appenderAttachable.AddAppender(appender);
            return(appender);
        }
Exemplo n.º 2
0
        public ILogLevelThresholdSelector AppendLogService(ILogService logService, IDictionary<string, object> additionalData = null)
        {
            if (CurrentLogger == null) return null;

            var appenderAttachable = CurrentLogger as global::log4net.Core.IAppenderAttachable;
            if (appenderAttachable == null) return null;

            var appender = new LogServiceAppender(logService);

            // let's examine potential parameters
            if (additionalData != null && additionalData.ContainsKey(PatternParameter))
            {
                var parameter = additionalData[PatternParameter];
                if (parameter != null && parameter is string)
                {
                    var pattern = (string)parameter;
                    appender.Layout = new global::log4net.Layout.PatternLayout(pattern);
                }
            }

            appender.LogLevelThreshold = LogLevel.All;
            appenderAttachable.AddAppender(appender);
            return appender;
        }