logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mauro Rallo <ra...@prosa.com>
Subject Re: Configure Log4net from code at RunTime
Date Wed, 24 Aug 2005 08:29:00 GMT
Ok, I found my mistake. I've to take the new Logger to configure from the
Hierarchy class and not from the LoggerFactory.
So the correct code is :

Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
Logger rootLogger = hierarchy.Root;
Logger coreLogger = hierarchy.GetLogger("abc") as Logger;
RollingFileAppender roller = new RollingFileAppender();
// .... create and configure appender ...///
coreLogger.AddAppender(roller);

I hope that can be useful to other people.

Mauro



Mime
View raw message