Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 91485 invoked from network); 14 Nov 2005 14:28:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Nov 2005 14:28:47 -0000 Received: (qmail 16590 invoked by uid 500); 14 Nov 2005 14:28:25 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 16549 invoked by uid 500); 14 Nov 2005 14:28:25 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 16531 invoked by uid 99); 14 Nov 2005 14:28:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2005 06:28:24 -0800 X-ASF-Spam-Status: No, hits=2.3 required=10.0 tests=DNS_FROM_RFC_POST,INFO_TLD,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of aok123@bellsouth.net designates 205.152.59.72 as permitted sender) Received: from [205.152.59.72] (HELO imf24aec.mail.bellsouth.net) (205.152.59.72) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2005 06:28:15 -0800 Received: from ibm71aec.bellsouth.net ([65.80.200.112]) by imf24aec.mail.bellsouth.net with ESMTP id <20051114142802.XBBI12920.imf24aec.mail.bellsouth.net@ibm71aec.bellsouth.net> for ; Mon, 14 Nov 2005 09:28:02 -0500 Received: from [172.16.1.39] (really [65.80.200.112]) by ibm71aec.bellsouth.net with ESMTP id <20051114142802.UMOK25210.ibm71aec.bellsouth.net@[172.16.1.39]> for ; Mon, 14 Nov 2005 09:28:02 -0500 Message-ID: <43789EF1.6050202@bellsouth.net> Date: Mon, 14 Nov 2005 09:28:01 -0500 From: Alex Karasulu User-Agent: Mozilla Thunderbird 1.0.7 (Macintosh/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: Logging and Logger Name Conventions References: <43762A85.3090906@bellsouth.net> <6.0.3.0.0.20051114110559.04f914e8@torino> In-Reply-To: <6.0.3.0.0.20051114110559.04f914e8@torino> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Ceki G�lc� wrote: > At 06:46 PM 11/12/2005, Alex Karasulu wrote: > >>> 2. I spotted a few calls to log.xxx() which are not wrapped in >>> log.isxxxEnabled() calls. This can lead to inefficiencies >>> especially when >>> the log.xxx() call involves String concatenation. See >>> org.apache.ldap.server.jndi.ServerContextFactory log.info() 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 http://www.slf4j.org/faq.html#2.3 > > 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. Alex