You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Mark Womack <mw...@bevocal.com> on 2002/08/06 18:40:02 UTC

FW: trace for inner classes

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( '$', '.' ) );
}

-Mark

-----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


Hello,

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
well 
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>