当前位置: 首页>>代码示例>>C#>>正文


C# RollingFileAppender.ClearFilters方法代码示例

本文整理汇总了C#中log4net.Appender.RollingFileAppender.ClearFilters方法的典型用法代码示例。如果您正苦于以下问题:C# RollingFileAppender.ClearFilters方法的具体用法?C# RollingFileAppender.ClearFilters怎么用?C# RollingFileAppender.ClearFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在log4net.Appender.RollingFileAppender的用法示例。


在下文中一共展示了RollingFileAppender.ClearFilters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Log4NetLoggerAdapter

 /// <summary>
 /// 初始化一个<see cref="Log4NetLoggerAdapter"/>类型的新实例
 /// </summary>
 public Log4NetLoggerAdapter()
 {
     const string fileName = "log4net.config";
     string configFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
     if (File.Exists(configFile))
     {
         XmlConfigurator.ConfigureAndWatch(new FileInfo(configFile));
         return;
     }
     RollingFileAppender appender = new RollingFileAppender
     {
         Name = "root",
         File = "logs\\log_",
         AppendToFile = true,
         LockingModel = new FileAppender.MinimalLock(),
         RollingStyle = RollingFileAppender.RollingMode.Date,
         DatePattern = "yyyyMMdd-HH\".log\"",
         StaticLogFileName = false,
         MaxSizeRollBackups = 10,
         Layout = new PatternLayout("[%d{yyyy-MM-dd HH:mm:ss.fff}] %-5p %c.%M %t %w %n%m%n")
         //Layout = new PatternLayout("[%d [%t] %-5p %c [%x] - %m%n]")
     };
     appender.ClearFilters();
     appender.AddFilter(new LevelMatchFilter { LevelToMatch = Level.Info });
     //PatternLayout layout = new PatternLayout("[%d{yyyy-MM-dd HH:mm:ss.fff}] %c.%M %t %n%m%n");
     //appender.Layout = layout;
     BasicConfigurator.Configure(appender);
     appender.ActivateOptions();
 }
开发者ID:liumeifu,项目名称:OSky,代码行数:32,代码来源:Log4NetLoggerAdapter.cs

示例2: Log4NetAdapter

        /// <summary>
        /// 初始化一个<see cref="Log4NetAdapter"/>类型的新实例
        /// </summary>k
        public Log4NetAdapter()
        {
//            var configFile = Path.Combine(ConfigPath, FileName);
//            if (File.Exists(configFile))
//            {
//                XmlConfigurator.ConfigureAndWatch(new FileInfo(configFile));
//                return;
//            }
            var appender = new RollingFileAppender
            {
                Name = "root",
                File = "logs\\log_",
                AppendToFile = true,
                LockingModel = new FileAppender.MinimalLock(),
                RollingStyle = RollingFileAppender.RollingMode.Date,
                DatePattern = "yyyyMMdd-HH\".log\"",
                StaticLogFileName = false,
                MaxSizeRollBackups = 10,
                Layout = new PatternLayout("[%d{yyyy-MM-dd HH:mm:ss.fff}] %-5p %c %t %w %n%m%n")
                //Layout = new PatternLayout("[%d [%t] %-5p %c [%x] - %m%n]")
            };
            appender.ClearFilters();
            appender.AddFilter(new LevelRangeFilter
            {
                LevelMin = Level.Debug,
                LevelMax = Level.Fatal
            });
            BasicConfigurator.Configure(appender);
            appender.ActivateOptions();
        }
开发者ID:shoy160,项目名称:Shoy.Common,代码行数:33,代码来源:Log4NetAdapter.cs

示例3: Log4NetLoggerAdapter

 public Log4NetLoggerAdapter()
 {
     var appender = new RollingFileAppender
     {
         Name = "root",
         File = "logs\\log4net.log",
         AppendToFile = true,
         LockingModel = new FileAppender.MinimalLock(),
         RollingStyle = RollingFileAppender.RollingMode.Size,
         StaticLogFileName = false,
         Threshold = Level.Debug,
         MaxSizeRollBackups = 10,
         Layout = new PatternLayout("%n[%d{yyyy-MM-dd HH:mm:ss.fff}] %-5p %c %t %w %n%m%n"),
     };
     appender.ClearFilters();
     appender.AddFilter(new LevelMatchFilter { LevelToMatch = Level.Info });
     BasicConfigurator.Configure(appender);
     appender.ActivateOptions();
 }
开发者ID:yanghongjie,项目名称:DotNetDev,代码行数:19,代码来源:Log4NetLoggerAdapter.cs


注:本文中的log4net.Appender.RollingFileAppender.ClearFilters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。