當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。