Vlad,
Logger.getLogger() would be certainly be very convenient. However, the JLS (Java Language Specification) explicitly states that the JVM can collapse stack frames as an optimization measure. In turn, this makes the analysis of stack frames unreliable which is the reason for us to avoid offering this very convenient but unreliable alternative.
I strongly encourage you to explore this matter in more depth. For the sake of thousands of tired fingers out there, I'd would love to be proven wrong. :-)
At 10:12 PM 11/26/2004, Vlad Skarzhevskyy wrote:
This is just the idea. See the last line. This may save some typing. And it generaly cost only 0.1 milliseconds. for 1000 classes application ~ 1 sec to start.
public class Womabat { // 3 curent ways to get logger static Logger logger = Logger.getLogger("com.wombat.Womabat"); // String variant static Logger logger = Logger.getLogger(Womabat.class.getName()); // another String variant static Logger logger = Logger.getLogger(Womabat.class); // convenient Class variant // 1 new way to get logger static Logger logger = Logger.getLogger(); // convenient Class variant that get the logger using stack from new Throwable(). .. }
-- Vlad
-- Ceki G�lc�
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
