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: Mon, 27 Feb 2012 04:53:33 +0000 (UTC) Organization: Your Company Lines: 125 Message-ID: References: <4f4a6b1d$0$290$14726298@news.sunsite.dk> <4f4ac151$0$291$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:12415 Arne Vajhøj wrote in news:4f4ac151$0$291$14726298 @news.sunsite.dk: > On 2/26/2012 4:08 PM, Novice wrote: >> Arne Vajhøj wrote in >> news:4f4a6b1d$0$290$14726298@news.sunsite.dk: >>> 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. > > That is general question not specific to logging or AOP. > > You need a good structure of your classes and source code. > > A key factor in the decision between com.novice.common and > com.novice.common.xxxx must be the number of classes. > > Do you have so many classes that it makes sense to split up? > >> 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. > > It should write to the file specified in the properties file. > > May we see that? > It's not very different from the standard one. I've just tweaked it a little bit. Here it is with the comments stripped out: ============================================================ handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler .level=INFO java.util.logging.FileHandler.pattern = %h/java%u.log java.util.logging.FileHandler.limit = 50000 java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter x.y.level = SEVERE x.y.z.level = WARNING org.sscce.level = WARNING org.sscce.baz3.level = INFO ========================================================================= I don't think the last four lines are going to do anything since I don't believe I have any packages with those names. I think those are just examples that I created when I first looked at logging a few years ago. The code that I'm executing is: ================================================================== package test; import java.util.logging.Level; import java.util.logging.Logger; public class TestLogging { public static void main(String[] args) { @SuppressWarnings("unused") TestLogging test = new TestLogging(); } public TestLogging() { Logger logger = Logger.getLogger("test"); logger.logp(Level.INFO, "myClass", "myMethod", "Monday"); logger.logp(Level.INFO, "myClass", "myMethod", "Tuesday"); logger.logp(Level.INFO, "myClass", "myMethod", "Wednesday"); logger.logp(Level.INFO, "myClass", "myMethod", "Thursday"); logger.logp(Level.INFO, "myClass", "myMethod", "Friday"); logger.logp(Level.INFO, "myClass", "myMethod", "Saturday"); logger.logp(Level.INFO, "myClass", "myMethod", "Sunday"); } } =================================================================== I'm running Windows XP so I know that %h is C:\Documents and Settings \Novice. There are five log files there, java0.log through java4.log, but none of them contain the days of the week or any log record that contain today's date. So those logs are not getting written to that path. I'm not sure if I'm doing something that is keeping them from being written at all or if they are being written to somewhere else in the file system. I don't _think_ I am suppressing them and I don't know where else to look for them. The logs aren't where the docs say they should be.... -- Novice