我有一个缺陷列表,其中包含零件号和缺陷代码
public static void SetLevel(string loggerName, string levelName)
{
ILog log = LogManager.GetLogger(loggerName);
Logger l = (Logger)log.Logger;
l.Level = l.Hierarchy.LevelMap[levelName];
}
// Add an appender to a logger
public static void AddAppender(string loggerName, IAppender appender)
{
ILog log = LogManager.GetLogger(loggerName);
Logger l = (Logger)log.Logger;
l.AddAppender(appender);
l.Repository.Configured = true;
}
// Create a new file appender
public static IAppender CreateSeqAppender(string name)
{
var seqAppender = new SeqAppender();
seqAppender.ServerUrl = ConfigurationManager.AppSettings["Seq:Url"];
var seqApiKey = ConfigurationManager.AppSettings["Seq:ApiKey"];
if (seqApiKey != null)
{
seqAppender.ApiKey = seqApiKey;
}
PatternLayout patternLayout = new PatternLayout();
var LOG_PATTERN = "%d [%t] %-5p %m%n";
patternLayout.ConversionPattern = LOG_PATTERN;
patternLayout.ActivateOptions();
seqAppender.Name = name;
seqAppender.BufferSize = 1;
seqAppender.Layout = patternLayout;
seqAppender.ActivateOptions();
return seqAppender;
}
static void Main()
{
BasicConfigurator.Configure();
// In order to set the level for a logger and add an appender reference you
// can then use the following calls:
SetLevel("Log4net.MainForm", "ALL");
AddAppender("Log4net.MainForm", CreateSeqAppender("SeqAppender"));
//BasicConfigurator.Configure();
var logger = LogManager.GetLogger("MyLogger");
logger.Info("This is a test log message");
}
现在我想计算除了每个刀片号码的缺陷代码TE之外的缺陷。
答案 0 :(得分:0)
答案 1 :(得分:0)