Hello there, and thank you so much for your work on JSR47! I'm
looking
forward to having a logging facility built in to J2SE. I've been a
user of log4j in commerical projects for almost two years now, and
have come to depend on the tool. It will be good to have something
similar in Java.
Three comments on the proposal, based on looking at the 1.4 API:
I was disappointed to see no VM level support for logging. I want to
be able to print out file and line numbers in my log messages. You
can
do this with log4j, but it's done via runtime hack of parsing the
string representation of a Throwable. The VM could help with this, if
it were in the 1.4 standard. The JSR47 alternative (passing in
sourceClass and sourceMethod as strings to Logger) is not very
helpful, I can't imagine code authors writing and maintaining
those.
I was also disappointed to see no compiler level support for
compiling
out logging entirely. Everyone I know has some variant of a static
final boolean that they switch on. It's important when shipping
proprietary code - it can be dangerous to leave the logging strings
in. But Java has a long history of no conditional compilation, so I
guess that's why there is no support for it.
But my main comment is that I am frankly mystified as to why JSR47
does not more closely resemble log4j, or why log4j was not just
adopted wholesale. Log4j is the defacto standard logging API, and has
had years of development and use. It has several advanced features
that are missing from JSR47. Ceki has written up a detailed review
that I mostly agree with:
For what it's worth, the big omissions in JSR47 to me are some sort
of
equivalent to PatternLayout, and the limited handler inheritance
properties of JSR47.
Frankly, at this point I don't see any reason to use JSR47 instead of
log4j, except that it will ship in Java 1.4 platforms. I see lots of
reasons log4j is better. Is it too late to bring the Java 1.4 API
closer to log4j?
Thank you
Nelson
nelson@monkey.org