logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: FW: trace for inner classes
Date Tue, 06 Aug 2002 16:49:52 GMT

IMHO, the Logger.getLogger( String name ) method should be left
untouched. The getLogger(Class) variant can be changed to replace '$'
with '.' just before calling getLogger(String).

The alternative is to consider '$' as a parent/child separator in
addition to '.' which I think would be unwise.

At 09:40 06.08.2002 -0700, you wrote:
>Shouldn't we consider this a bug?  Shouldn't log4j treat inner classes as
>part of the class/package hierarchy and have them use the same appenders as
>their parent class?  I just think that having to do something special for
>this case is not right.
>Thomas Muller suggested the following patch, but maybe there is a better way
>do support this?
>If you don't like the suggested approach, you can alternatively patch the
>Logger::getLogger( String name ) method:
>static public Logger getLogger( String name ) {
>         return LogManager.getLogger( name.replace( '$', '.' ) );
>-----Original Message-----
>From: Herve AGNOUX [mailto:herve.agnoux@diaam-informatique.com]
>Sent: Monday, August 05, 2002 6:27 AM
>To: log4j-user@jakarta.apache.org
>Subject: trace for inner classes
>In all my categories I use Logger.getLogger(getClass()). So with the inner
>classes I obtain a category-name like "MainClass$SubClass".
>When I design an appender on a class, I expect that all the inner class have
>the same ; if I do :
>log4j.category.MainClass=INFO, A4
>I expect that MainClass$SubClass has the appender A4. But it's not, if I
>understand, it's because MainClass$SubClass is not a subcategory of
>MainClass, the Good Name should be MainClass.SubClass.
>Is there an easy way to obtain what I excpect ?
>And in bonus, is it possible to have some alias for the usual patterns ? For
>instance VERY_SHORT="%m\n", VERY_INTERSTING="%r [%t] %-5p
>%c"... and so on ?
>Thanks in advance.
>To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>
>To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>

View raw message