directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Karasulu <>
Subject Re: Logging and Logger Name Conventions
Date Mon, 14 Nov 2005 14:28:01 GMT
Ceki Gülcü wrote:

> At 06:46 PM 11/12/2005, Alex Karasulu wrote:
>>> 2.  I spotted a few calls to which are not wrapped in
>>> log.isxxxEnabled() calls.  This can lead to inefficiencies 
>>> especially when
>>> the call involves String concatenation.  See
>>> org.apache.ldap.server.jndi.ServerContextFactory calls for
>>> examples.  Can these be changed?
>> Sure Simon you are 100% right. I don't think anyone has made it a 
>> good practice to wrap these things.  I will make sure I do this all 
>> the time.  I will accept and apply any patches that wrap log called 
>> with a conditional to see if the log level is enabled.  I will apply 
>> it immediate if you or anyone else can provide them.
> If you are using SLF4J, then wrapping is not necessary. Instead of 
> writing,
> if(logger.isDebugEnabled()) {
>   logger.debug("User name is "+name+".");
> }
> you can write
>   logger.debug("User name is {}.", name);
> The second form is more convenient, has a smaller footprint (both in 
> memory and on disk) and is slightly faster.
> For more details, please refer to
> I hope this helps,

Thanks again Ceki.  I forgot that this second overload actually does the 
check for us.  Good thing to point out yet again and again.  I'm sure 
people will gravitate as I did to the old way.


View raw message