Return-Path: X-Original-To: apmail-cassandra-dev-archive@www.apache.org Delivered-To: apmail-cassandra-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D46DEDAA4 for ; Fri, 23 Nov 2012 17:25:22 +0000 (UTC) Received: (qmail 62338 invoked by uid 500); 23 Nov 2012 17:25:21 -0000 Delivered-To: apmail-cassandra-dev-archive@cassandra.apache.org Received: (qmail 62288 invoked by uid 500); 23 Nov 2012 17:25:21 -0000 Mailing-List: contact dev-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list dev@cassandra.apache.org Received: (qmail 62277 invoked by uid 99); 23 Nov 2012 17:25:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Nov 2012 17:25:21 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of stephen.alan.connolly@gmail.com designates 74.125.82.172 as permitted sender) Received: from [74.125.82.172] (HELO mail-we0-f172.google.com) (74.125.82.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Nov 2012 17:25:16 +0000 Received: by mail-we0-f172.google.com with SMTP id r3so2139638wey.31 for ; Fri, 23 Nov 2012 09:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=lht4ExWuUGaLW9tLSJtFe3tOcEyh5O9QTQMswSdGALA=; b=n6IWVPQcHbXAHX3b+VH3MMfZ28OFS4DPD5lQIGeYPF8bsVNAPksV7nyefVuYzIjN6k WDouJn4EN4xBAwaT0MLHtKdOmynFzZqA4kppMFAJhYELli4NxGxIwPoPEOlemXt2OYKE W7Y3mDEhL6oI0sSJcHOeFPNOLNhSqSKbyHFwXRPxvkiy9JxDgqm2kbsqHbAKGSiTX6ug AP0f602Np4qHmQh7qU2oEA+zxnO/kjPDfLSrQaPR+DyaJCDQvX7CMadX74e+2KsGb/W6 L8iVgp/CGP4RIZ5623Rx6NnitzAKWK+U8esbYkX435CGlcCveViBsLP6yLzGNDiNolup PBbg== MIME-Version: 1.0 Received: by 10.180.102.161 with SMTP id fp1mr7397640wib.9.1353691495352; Fri, 23 Nov 2012 09:24:55 -0800 (PST) Received: by 10.217.5.195 with HTTP; Fri, 23 Nov 2012 09:24:55 -0800 (PST) In-Reply-To: <50AFAFA0.9000303@mebigfatguy.com> References: <50AE660D.1050802@filez.com> <50AFAFA0.9000303@mebigfatguy.com> Date: Fri, 23 Nov 2012 17:24:55 +0000 Message-ID: Subject: Re: slf4j From: Stephen Connolly To: dev Content-Type: multipart/alternative; boundary=f46d044481bfb74b4304cf2cdcd6 X-Virus-Checked: Checked by ClamAV on apache.org --f46d044481bfb74b4304cf2cdcd6 Content-Type: text/plain; charset=ISO-8859-1 On 23 November 2012 17:17, Dave Brosius wrote: > There are actually 2 arguments the OP is making.. the second, using > > {} : {} > > > over > > > descriptor + ": " + (System.currentTimeMillis() - start) > > is reasonable. > > Having had to do a search & replace over an entire code base (thank you IntelliJ structural search) to remove the string concat in logging due to the GC pressure it caused. I tend to agree on that second point. > > On 11/23/2012 10:18 AM, Jonathan Ellis wrote: > >> I prefer the concise approach when no evaluation needs to be performed >> on the method arguments, but when it does I prefer the explicit >> isDebugEnabled check, or else reviewers need to think each time they >> see one, "is this a hot code path where we can afford to be sloppy, or >> not?" >> >> On Fri, Nov 23, 2012 at 9:14 AM, Stephen Connolly >> > >> wrote: >> >>> On 22 November 2012 17:51, Radim Kolar wrote: >>> >>> instead of this: >>>> >>>> if (logger.isDebugEnabled()) >>>> logger.debug("INDEX LOAD TIME for " + descriptor + ": " + >>>> (System.currentTimeMillis() - start) + " ms."); >>>> >>>> do this: >>>> logger.debug("INDEX LOAD TIME for {} : {} ms.", descriptor, >>>> (System.currentTimeMillis() - start)); >>>> >>>> Yes, but until/unless the JVM elides the function call because that >>> logger >>> is not enabled fro debug, you will incur the penalty of new >>> Object[]{string,new Long(System.currentTimeMillis(**) - start). >>> >>> On top of that, when debug is enabled you incur the cost of formatting >>> the >>> string, including the {} search & replace. >>> >>> On a long running production system, you are correct that it should >>> *eventually* be equivalent, and I am not saying one way or the other >>> whether this should/shouldn't be changed... more just pointing out that >>> there are consequences to what might appear to be a trivial change... >>> I'll >>> let the c* devs chime in as to what their strong opinion is in this >>> regard >>> as they should have more experience handling high loads and I would love >>> to >>> know which pattern I should be using in my code (FWIW I tend to favour >>> your >>> approach to the if (debugEnabled) guard... but I always wonder ;-) ) >>> >>> -Stephen >>> >>> >>> easier to read. >>>> >>>> >> >> > --f46d044481bfb74b4304cf2cdcd6--