logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Whitall <fiddlerpian...@yahoo.com>
Subject Naming loggers / resolving calling classes
Date Wed, 09 Apr 2003 14:54:18 GMT

I have a problem.  In my logging message, I want to be
able to output the name of the class that initiates
the logging, i.e. the caller, with something similar
to this:

[2003-04-08 19:57:40,019 INFO] com.mycompany.MyClass: 

I cannot afford to use the %C option for
PatternLayout, because it really is a performance hog
(it was taking 300ms for one logging statement!)  The
only other option that I can think of is to
instantiate separate loggers for each class by using
the class name as the logger name, and then using %c
in the conversion pattern instead of %C.  I have seen
this done in a few examples.  Is this considered best
practice, or are there serious performance
considerations with getting separate loggers like


Jonathan Whitall

Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more

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

View raw message