Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Novice Newsgroups: comp.lang.java.programmer Subject: Re: Aspect questions? Date: Sun, 26 Feb 2012 20:52:44 +0000 (UTC) Organization: Your Company Lines: 40 Message-ID: References: NNTP-Posting-Host: Dmxgbnvd+eoRDUV2lwYf7Q.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: Xnews/5.04.25 X-Antivirus-Status: Clean X-Notice: Filtered by postfilter v. 0.8.2 X-Antivirus: avast! (VPS 120226-2, 2012-02-26), Outbound message Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:12378 markspace <-@.> wrote in news:jidsj5$k5u$1@dont-email.me: > On 2/26/2012 9:22 AM, Novice wrote: >> If so, the next logical step would be to treat all the stuff in the >> Common project similarly. If I put all of those classes in package >> com.novice.common, then each class would have this: >> >> Logger logger = Logger.getLogger("com.novice.common"); > > > Just as an aside, it's more common to use something like > > java.util.logging.Logger.getLogger( getClass().getName() ); > Of course. I was already intending to substitute that once I'm clear on what my code should be doing. I'd much rather derive the name rather than hard-code it. > instead of a string constant. String constants probably won't be > refactored when a class is renamed or moved to another package. The > above needs no refactoring. > > Also: > > > > This section points out that it's more efficient to use "static" for the > logger. In desktop apps, that's what I'm used to seeing. However it > also says that "static" interacts poorly with JEE classloaders, so using > instance variables is the norm in JEE (and w/ Tomcat too). > I'm writing more applications/Java Web Start these days than servlets so maybe I should use 'static' and then remember NOT to use it in servlets.... -- Novice