--- __matthewHawthorne <[EMAIL PROTECTED]> wrote:
> This is a general use question about [logging].  I'm looking through the
> 
> source for [betwixt], and I see lines like the following:
> 
> if ( log.isTraceEnabled() ) {
>    log.trace( "Is " + descriptor + " empty?" );
> }
> 
> What is the purpose of doing this check?  If trace *is* enabled, then 
> isn't the same check done inside of the underlying logging
> implementation?

Yes, this code is doing the check twice.

> 
> Is this some type of trick to improve performance?  I'm probably 
> misunderstanding it, but I just think that it adds clutter.

This is an attempt to optimize the logging but I would be *very* surprised
if it actually acheived any noticable performance benefits in most cases. 
Much Jakarta code I've seen uses the if checks on logging calls except in
catch blocks.  If you're in the catch block, you've already incurred the
cost of the exception mechanism so optimizing the logging doesn't make
much sense.

In my own code, I never use the if check because of the clutter.

David

> 
> Any insights?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to