logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Sturm <oli...@sturmnet.org>
Subject Re: Log4Net API to get appender config properties
Date Wed, 08 Dec 2004 13:35:28 GMT
Hey Nicko,

you may have noticed that you answered my recent question ("Finding out 
whether a specific appender is attached") with this, too (although I 
haven't tried it yet). Just two comments inline below:

Nicko Cadell wrote:

>You can get all the current appenders by using a method like:
>
>public static log4net.Appender.IAppender[] GetAllAppenders()
>{
>  ArrayList appenders = new ArrayList();
>
>  log4net.Repository.Hierarchy.Hierarchy h =
>(log4net.Repository.Hierarchy.Hierarchy)log4net.LogManager.GetLoggerRepo
>sitory();
>  
>
Why do you assume that this ILoggerRepository is really a Hierarchy?

>  appenders.AddRange(h.Root.Appenders);
>
>  foreach(log4net.Repository.Hierarchy.Logger logger in
>h.GetCurrentLoggers())
>  
>
Why do you assume that this ILog is really a Logger?

I usually tend to be quite careful with libraries written by other 
people when interfaces are in use. I assume that interfaces have been 
used for a reason, that reason being that it's not safe to assume that 
the actual object is always of some specific class type. Why else would 
I be using interfaces? In log4net, have interfaces been used for some 
other reason so it's safe to make assumptions about the classes 
implementing them?

Thanks,

               Oliver Sturm
-- 
omnibus ex nihilo ducendis sufficit unum
MSN oliver@sturmnet.org Jabber sturm@amessage.de ICQ 27142619


Mime
View raw message