>> - No more need to do
>>
>> if(debug > 1)
>> log("Some message");
>>
>> instead one would write
>>
>> log.debug("Some message");
>>
>> where log is an instance of org.apache.log4j.Category.
>>
>
>
> Although not evident in your example above, there is a potentially
> substantial performance penalty for changing to this approach for some
> kinds of messages.
>
> Consider the following simple case (taken from StandardWrapperValve):
>
> if (debug >=1)
> log("Processing " + errorPage);
>
> If that is changed as Ceki suggests:
>
> log.debug("Processing " + errorPage);
>
> then the string concatenation in this expression is done every single
> time, whether you decide to log the result or not. In the current code,
> the expression is only evaluated if you have turned debugging on
> (presumably that means you are not concerned about performance impacts
> when you are debugging).
>
> How do Log4J users deal with this kind of thing?
What he meant was:
if(log.isDebugEnabled())
log.debug("Processing " + errorPage);
;-)
Scott Sanders