On Sat, 21 Apr 2001, Scott Sanders wrote:
> What he meant was:
>
> if(log.isDebugEnabled())
> log.debug("Processing " + errorPage);
>
> ;-)
I can certainly see that, but it sure blows the "shorter code" advantage
that was touted :-). It also seems a little redundant -- if I want to
make this message happen at the "warning" level instead, do I need to
change two things?
if (log.isEnabledFor(Priority.WARN))
log.warn("Processing " + errorPage);
Performance of this is not really relevant for things that happen once
(context startup) or only rarely (unusual exceptions). It matters a lot
on stuff that happens for every single request. And I would submit that
"if (debug >= x)" will run faster that any method call to double check
whether a logging level is enabled or not.
Moral of the story -- let's be very careful in how we instrument the code
with logging calls.
> Scott Sanders
>
>
Craig