You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jonathan Whitall <fi...@yahoo.com> on 2003/04/09 16:54:18 UTC
Naming loggers / resolving calling classes
Hello,
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:
message
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
this?
Thanks,
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