logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Regan <treg...@hotmail.com>
Subject getting the log4net appenders at runtime
Date Tue, 12 Jul 2005 16:37:07 GMT
My root appender writes to a text file.  I need to get the path to the text 
file at runtime (the FileAppender.File property).  Is there any way to do 
that? 

For example, this pulls back an empty collection of file appenders.  How do I 
get the full one?  I'm doing this after calling DomConfigurator.Configure():

log4net.Repository.Hierarchy.Hierarchy h = 
(log4net.Repository.Hierarchy.Hierarchy)log4net.LogManager.GetLoggerRepository
();
foreach(log4net.Appender.FileAppender fa in h.Root.Appenders)
{
	string s = a.File;
}


The log4net.helpers.AppenderAttachedImpl object has an Appenders collection.  
But how do I instantiate an AppenderAttachedImpl object so that it pulls back 
the Appenders collection for the current log4net configuration? 

For example, if I simply instantiate it like so: 

log4net.helpers.AppenderAttachedImpl = new log4net.helpers.AppenderAttachedImpl
() 

I also get back an empty collection of appenders. 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message