I just blogged about 1.3a here...
http://www.peerfear.org/rss/permalink/2004/12/18/ThrowableDebuggingWithLog4J13/
Any chance I could see this feature added?
Now lets take this one step
further now that they're working on 1.3 and suggest
a small bit critical feature
:
Most people use Log4J with a
logger based on the classname:
So we would probably see:
static Logger logger = Logger.getLogger( "org.apache.commons.feedparser.locate.FeedLocator"
);
Which is amazingly verbose. A
lot of developers shorten this to:
static Logger logger = Logger.getLogger( FeedLocator.class
);
But this still leaves us with
cut and paste errors.
What if we could just reduce
it to:
static Logger logger = Logger.getLogger();
The code for this is pretty simple. All you have to do is add the
following
getLogger() method:
public static Logger getLogger() {
Exception e = new Exception();
String category = e.getStackTrace()[1].getClassName();
return LoggerManager.getLogger( category );
}
I'm going to send this to the log4j developer list and hope they add
it.
--
Use Rojo (RSS/Atom aggregator). Visit http://rojo.com. Ask me for an
invite! Also see irc.freenode.net #rojo if you want to chat.
Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
If you're interested in RSS, Weblogs, Social Networking, etc... then you
should work for Rojo! If you recommend someone and we hire them you'll
get a free iPod!
Kevin A. Burton, Location - San Francisco, CA
AIM/YIM - sfburtonator, Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
|
- Throwable Debugging with Log4J 1.3 (patch for 1.3a? ) Kevin A. Burton
-