logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eduardo Francos <efrancosos-S...@incontext.fr>
Subject Re: discreet log types
Date Fri, 15 Aug 2003 07:28:08 GMT
Larry Young wrote on 08/15/2003 03:12 AM:
> Paul,
> 
>         Yes, actually I had already gone down that road as one of my 
> first solutions before I posted my original message.  However, when I 
> considered that option, I was appending the logging type, which was a 
> problem when trying to specify packages instead of individual classes.  
> But your suggestion to put it at the beginning could solve that problem.
> 
>         I'm not so worried about it being clumsy because I can always 
> hide it with a wrapper around the front-end if necessary (i.e. create a 
> static factory-like method).  And I would only have to define loggers 
> for the logging types that my class would be using, not necessarily 
> every one that is defined, especially since the list needs to be 
> extensible.  And it would also allow me to enable multiple logging types 
> for a single class/package.
> 
>         I'll have to give this one some more thought!  It's not the 
> cleanest of solutions, but if no one else on the list thinks this would 
> be a good feature to have, then perhaps this would be the quickest 
> solution for my situation.  Thanks again for your ideas!
> 
> --- regards ---
> Larry
> 
> 
> 
> At 10:51 AM 8/15/03 +1000, you wrote:
> 
>> On Fri, 2003-08-15 at 10:52, Larry Young wrote:
>> > Paul,
>> >
>> >          Yes, I need to be able to specify which class may display 
>> which
>> > set of discreet types.  For example, I might have "com.*" allowed to
>> > display ERROR, but then override that for "com.xyz.MyClass" to 
>> display only
>> > TIMING,  "com.abc.def.*" to display METHOD_TRACE & TIMING, and
>> > "com.abc.dataaccess.*" to display DB_ACCESS.
>>
>> <snip/>
>>
>> Yeah, the more I think about it the more I see the issue.  Ouch.
>>
>> Ok, since in each class you like have something like this:
>>
>> public static final Logger LOG = Logger.getLogger(MyClass.class);
>>
>> Could you do something like this? (Cumbersome still, but hey, if you
>> want Ultimate Configuration it comes with Ultimate complexity usually
>>
>> public static final DBLogger = Logger.getLogger("DB." +
>> MyClass.class.getName() );
>>
>> public static final TimerLogger= Logger.getLogger("Trace." +
>> MyClass.class.getName());
>>
>> ...
>>
>> That way you will have a Logger for every class and every aspect.  You
>> can then turn _ALL_ Trace logging by setting the "DB" Logger to whatever
>> level, then all the class names inherit from it.  You can then also set
>> "DB" to INFO, but override with "DB.com.mycompany.MyClass=DEBUG".
>>
>> Would that help?
>>
>> cheers,
>>
>> Paul
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> 
> --------------------------
> Larry Young
> The Dalmatian Group
> www.dalmatian.com

I believe your concern will be covered in Log4j 1.3 under the topic 
Logging Domains. It's described in the plan as "a very powerful and 
innovative concept that extends the notion of hierarchical loggers. It 
will also allow dynamic logging with pin-point accuracy"
I cannot be sure of this because there isn't much written on the subject 
but I remember a discussion about it somewhere (sorry, I don't remember 
where) that described logging domains in a way tha would cover the needs 
of your discreet types.

Eduardo




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


Mime
View raw message