Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Question about loggers Date: Fri, 9 Mar 2012 07:11:33 -0800 (PST) Organization: http://groups.google.com Lines: 29 Message-ID: <17863687.969.1331305893320.JavaMail.geo-discussion-forums@vblb5> References: <4f57de3b$0$286$14726298@news.sunsite.dk> <4f57fc25$0$290$14726298@news.sunsite.dk> <29668555.311.1331223311031.JavaMail.geo-discussion-forums@vbbfv2> NNTP-Posting-Host: 193.0.246.21 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1331305893 31094 127.0.0.1 (9 Mar 2012 15:11:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 9 Mar 2012 15:11:33 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.0.246.21; posting-account=MGO7qgoAAABvyo26eHVDO00044spH-ws User-Agent: G2/1.0 X-Received-Bytes: 2510 Xref: csiph.com comp.lang.java.programmer:12799 On Thursday, March 8, 2012 7:05:57 PM UTC+1, markspace wrote: > On 3/8/2012 8:15 AM, Robert Klemme wrote: > > > > We should mention that this is not exactly equivalent from the > > logging point of view. >=20 > Also be aware that while static loggers are common in Java in general,=20 > instance loggers are recommended best practice according the the Apache= =20 > Commons website. I think this is not exactly true if you are referring to this: "Note that for application code, declaring the log member as "static" is mo= re efficient as one Log object is created per class, and is recommended. Ho= wever this is not safe to do for a class which may be deployed via a "share= d" classloader in a servlet or j2ee container or similar environment. If th= e class may end up invoked with different thread-context-classloader values= set then the member must not be declared static. The use of "static" shoul= d therefore be avoided in code within any "library" type project." http://commons.apache.org/logging/guide.html Truth is that static loggers are recommended for application code; only for= library code they recommend against static loggers. Kind regards robert