directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ersin Er" <ersin...@gmail.com>
Subject Re: [Logging] Is this required if we use substitutions
Date Fri, 06 Jun 2008 06:10:47 GMT
Hi,

I think this is more of an issue of parameter evaluation than string
concatenation. If you do not do a IS_DEBUG check first, then even if the
debug is not enabled, opContext.getEntry() and opContext.getDn().getUpName()
will have to be evaluated first (before the debug method is called). So if
these are particularly expensive operations you may have a serious CPU cycle
loss. The example here is not perfect for demostrating this situation but if
one of the parameters was calculated via a DN parsing operation then the
result (without IS_DEBUG) would be quite bad.

Greetings,

On Fri, Jun 6, 2008 at 7:40 AM, Alex Karasulu <akarasulu@apache.org> wrote:

> Emmanuel,
>
> I see in some places you protect calls to LOG.debug() for example with a
> IS_DEBUG conditional like so:
>
>         if ( IS_DEBUG )
>         {
>             LOG.debug( "Adding the entry {} for DN = '{}'",
> opContext.getEntry(), opContext.getDn().getUpName() );
>         }
>
> If the {} based substitution is used, then does this not protect us from
> additional String concatenation?  Is the above more efficient than:
>
>          LOG.debug( "Adding the entry {} for DN = '{}'",
> opContext.getEntry(), opContext.getDn().getUpName() );
>
> Thanks,
> Alex
>



-- 
Ersin Er
http://www.ersin-er.name

Mime
View raw message