On Wed, 20 Nov 2002 04:05, Tony Thompson wrote:
> I was curious if someone could explain better why the Logger.getCategory()
> method is deprecated?  I know the code already has this comment in it:
>
> This method violates Inversion of Control principle.  If you are relying on
> its presence then there may be something wrong with the design of your
> system
>
> I am trying to determine at runtime what the category hierarchy looks like
> so that I can enable different levels of logging at each category.  From
> what I can tell, walking through the logger hierarchy and getting the
> category name of each Logger seemed to be the way to do it.  Since
> getCategory() is deprecated, can anyone suggest how I can accomplish this?

Just use getCategory(). 

Originally we deprecated it because we wanted to separate "management" from 
"client" usage of toolkit. ie In Avalon we used to pass the logger to any 
component that implemented Loggable and we did not want them being able to 
know about the category they have received.

We considered all the setters and that getter as part of the management 
interface while the "client" interface is basically that defined in 
avalon.logger.Logger

> Also, since I am asking questions, how do you turn off logging completely
> for a category?  Would you just set the priority to FATAL_ERROR?

That would still catch fatal errors. The best way to do it would be to attach 
a NullOutputLogTarget

-- 
Cheers,

Peter Donald
---------------------------------------------------
"It is easy to dodge our responsibilities, but we 
cannot dodge the consequences of dodging our 
responsibilities." -Josiah Stamp 
--------------------------------------------------- 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to