Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Question about loggers Date: Fri, 9 Mar 2012 10:56:04 -0800 (PST) Organization: http://groups.google.com Lines: 31 Message-ID: <19421419.801.1331319364495.JavaMail.geo-discussion-forums@pbls8> References: <4f57de3b$0$286$14726298@news.sunsite.dk> <4f57fc25$0$290$14726298@news.sunsite.dk> <29668555.311.1331223311031.JavaMail.geo-discussion-forums@vbbfv2> <17863687.969.1331305893320.JavaMail.geo-discussion-forums@vblb5> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1331319832 13402 127.0.0.1 (9 Mar 2012 19:03:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 9 Mar 2012 19:03:52 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2637 Xref: csiph.com comp.lang.java.programmer:12813 On Friday, March 9, 2012 7:54:21 AM UTC-8, markspace wrote: > Lew wrote: >> Declaring a log member as 'static' is not more efficient. What are they >> talking about? >=20 >=20 > Probably the blindingly obvious point that O(1) instantiation of the=20 > logger is better than a per-object O(n) instantiation. A difference that makes no difference is no difference. Beware premature optimization. I suppose I'm just saying that making recommendations based on "efficiency"= that affects something like 10^-6 proportion of runtime is grandiose at be= st. Going after the most minuscule contributor to efficiency first is not e= fficient. Ergo, taking overall efficiency into account, not just the neglig= ible contribution of CPU at runtime but the significant contribution of eng= ineering time over the life cycle, that advice is counter to the goal of ef= ficiency. Bear in mind that we're only talking about the cost of a reference; the log= ger object itself is only instantiated once per class using the discussed-t= o-death convention of identification of=20 the logger with the class.=20 I recommend scoping the logger as any other variable - to the scope of its = use. --=20 Lew