How do I add an extra log appender in runtime? (all pre-existing appenders must keep on working)
I'm trying it this way:
var layout = new PatternLayout("%utcdate %-5level - %message%newline");
layout.ActivateOptions();
_log4netAppender = new FileAppender
{
Layout = layout,
File = logFilePath,
};
_log4netAppender.ActivateOptions();
BasicConfigurator.Configure(_log4netAppender);
but it doesn't write anything to the file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…