Anders,
> SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST
>
> Comparing with the Geronimo logging levels,
>
> SEVERE corresponds to FATAL
> nothing corresponds to ERROR
> WARNING corresponds to WARN
> INFO corresponds to INFO
> CONFIG corresponds to nothing
> FINE corresponds to DEBUG
> FINER corresponds to TRACE
> FINEST corresponds to nothing
I think it would be better if it was:
FINE corresponds to nothing
FINER corresponds to FINER
FINEST corresponds to TRACE
That leaves "FINE" open as a spot between info and debug. One area I think
we use that spot in celtix is for logging buffers. Buffers are something
that falls between info stuff (service deployed, client connect, etc...) and
debug. Many times, people want the buffers, but without all the extra debug
stuff that really doesn't apply to them.
That said, buffers are more useful in SOAP/XML than IIOP. :-)
> In j.u.l, this becomes:
>
> if(logger.isLoggable(Level.FINER) {
> log.finer("About to do stuff " + stuff);
> }
>
> I personally don't like this style very well. Wouldn't it be an idea to
> create a log utility object and do something like this:
>
> LogUtil.log(logger, Level.FINER, "About to do stuff " + stuff);
> or perhaps even
> LogUtil.logFiner(logger, "About to do stuff " + stuff);
Neither of those avoid the string concatination. The whole point of the "if"
statement is to make sure the string concat isn't done as that is potentially
very costly. It's a little more verbose, but it's really the only way to
avoid it.
That said, the "more correct" way to do it would be with a resource bundle:
log.log(Level.FINER, "ABOUT_TO_DO_STUFF_ID", stuff);
or, since it's FINER and we don't really care anout localizationn:
log.log(Level.FINER, "About to do stuff {0}", stuff);
That only works for a single param though. For multiple params, it would
be:
log.log(Level.FINER, "About to do stuff {0} and {1}",
new Object[] {stuff, stuff1});
in which case you would want to wrap it with the if statement to avoid
the "new Object[]" creation. (although the Object[] creation is a lot
cheaper than the string concat)
Enjoy!
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194 F:781-902-8001
[EMAIL PROTECTED]