logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Womack <wom...@adobe.com>
Subject RE: getting the log4net appenders at runtime
Date Tue, 12 Jul 2005 16:58:01 GMT
Or the log4net-user email list, sorry.

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Tom Regan
> Sent: Tuesday, July 12, 2005 9:37 AM
> To: log4j-user@logging.apache.org
> Subject: getting the log4net appenders at runtime
> 
> 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.GetLoggerReposi
> tory
> ();
> 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


---------------------------------------------------------------------
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