本文整理汇总了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();
}
示例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();
}
示例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();
}