本文整理匯總了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();
}