logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Whitall <fiddlerpian...@yahoo.com>
Subject RE: Naming loggers / resolving calling classes
Date Wed, 09 Apr 2003 15:20:33 GMT
--- "Shapira, Yoav" <Yoav.Shapira@mpi.com> wrote:
> 
> Howdy,
> How about adding getClass().getName() to every
> logging call inside your
> classes?
> 
> Yoav Shapira
> Millennium ChemInformatics
> 

Well, I could do that, but that would put the
responsibility for making sure that the class name is
pre-prepended to every message that I am logging.

So when I go to log, my code would look something
like:
log.info(formatMessage(this, "My message"));

instead of just
log.info("My message");

The types of loggers that I am used to working with
have the option of passing a handle to the current
calling object, and then the logging system itself is
configured to render that object handle in the format
desired, not the caller.  Something like this:
log.info(this, "My message");

Obviously, Log4j doesn't take the object handle at
all, so I have to work around it some way.  I would
rather not leave formatting up to the caller.

Jonathan Whitall

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

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