avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: [LogKit] public Hierarchy.getRootLogger()
Date Mon, 24 Sep 2001 14:46:36 GMT
On Tue, 25 Sep 2001 00:42, Sylvain Wallez wrote:
> Hi all,
>
> Would it be possible to make Hierarchy.getRootLogger() public ?

probably ;)

> Having it protected implies some limitations on LogKit usage. The one I
> came across today is that it's not possible to set several log targets
> on an entire hierarchy (Hierarchy.setDefaultLogTarget accepts only one
> LogTarget).

yep. I have come up against this and ended up adding a MulticastTarget that 
just propogates to multiple targets.

> The only issue I see is that it exposes the logger hierarchy. But is it
> really an issue, since you can get any Logger (apart root) from the
> Hierarchy itself ?

The original issues were that the whole system relies on the fact that the 
root Logger has non-null LogTargets and that certain methods are not called 
on root Logger. Getting around these limitations would be tricky if anyone 
had access to that logger. I haven't looked at code recently but I think that 
these conditions still hold. Generally I prefer the safety of this 
encapsulation.

The question really becomes; Is there a better way to do what you want? ie 
Would it be better to add extra methods to hierarchy that manipulated root 
logger (in a safe way). Or perhaps I could commit my MulticastTarget or maybe 
you could do something like

class MyCustomHierarchy extends Hierarchy
{
...do your tricky stuff here...
}

or maybe something else? Would any of them work?

-- 
Cheers,

Pete

----------------------------------
   "Don't play dumb with me. 
I happen to be an expert at that" 
           - Maxwell Smart
----------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message