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 21:08:49 +0000 (UTC) Organization: Your Company Lines: 72 Message-ID: References: <4f4a6b1d$0$290$14726298@news.sunsite.dk> 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:12381 Arne Vajhøj wrote in news:4f4a6b1d$0$290$14726298@news.sunsite.dk: > On 2/26/2012 12:22 PM, Novice wrote: >> But I'm still confused about the scope of my logs. According to the >> logging overview, I want the argument to Logger.getLogger() to be "A >> name for the logger. This should be a dot-separated name and should >> normally be based on the package name or class name of the subsystem, >> such as java.net or javax.swing." >> >> I expect that they are assuming that each project has a unique >> package name. Therefore, if my company is novice.com, then the Foo >> project will presumably have a package named com.novice.foo and the >> Bar project will have a package named com.novice.bar. Then, the >> logging for the Foo project will be based on >> Logger.getLogger("com.novice.foo"), right? Then every class within >> the Foo project will have the line: >> >> Logger logger = Logger.getLogger("com.novice.foo"); >> >> Have I got this so far? >> >> 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"); >> >> Or would it be better to get a reference to the logger within Foo and >> pass that to the classes in the Common project so that they write to >> the logger used by the instantiating class from Foo? > > The standard is to use the full (with package) class name as > the name of the logger. > > Because logger configuration is applied tree wise, then you can > still configure at package level. > > If you used package name as logger name, then you could > not configure by class. > Okay, fair enough. Hmm, I need to think through the implications of that.... So, with respect to my common classes, should they all be in one big package, like com.novice.common? Or is it better to group them on some basis so that different types of common modules are in their own packages? If grouping them is a good idea, what's the best way to group them? I'm currently grouping mine on a more-or-less functional basis. If the class is essentially just a table lookup or enum, then it goes in the com.novice.common.lookups package. If it is a utility, it goes into com.novice.common.utilities. And so forth. Also, do you have any idea where to find the log records I am writing when I use Logger.getLogger("test") in my play code? I've tried the location stated in logging.properties and I've tried \Sun\Java\Deployment\log on Windows as suggested in http://docs.oracle.com/javase/1.5.0/docs/guide/deployment/deployment- guide/tracing_logging.html but I'm not finding it. There are files there but the days of the week are NOT in them and that's what I wrote to my logger. I don't know where else to look. -- Novice