Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #12752
| Date | 2012-03-07 17:16 -0500 |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Question about loggers |
| References | <XnsA00FACCA4B5E9jpnasty@94.75.214.39> |
| Message-ID | <4f57de3b$0$286$14726298@news.sunsite.dk> (permalink) |
| Organization | SunSITE.dk - Supporting Open source |
On 3/7/2012 4:52 PM, Novice wrote: > I'm working my way through Stephen Stelting's book Robust Java and have > some questions about the use of the Logging API (java.util.logging) in > Chapter 5. > > My impression from the "Aspect Questions" thread was that the "best > practices" approach to logging was to use named loggers, where, in essence, > each method that needs to write to the log creates a named logger via > > Logger logger = Logger.getLogger(getClass().getName()); > > and then writes to the log. > > Did I get that right? Stelting mentions anonymous loggers and the global > logger starting on page 71.I see from the API (and by actually trying it in > the sample program below) that the global logger is no longer a recommended > technique but are there any common circumstances where a professional > program would use anonymous loggers? Or are they more a case of something > that might be used in a "sandbox" type program to try something out? I can not see why saving to type something that give the class name should be smart even for small things. > Also, Stelting mentions that you can use the LogManager to "cache Logger > objects for repeat use". What circumstances would justify using LogManager? > I was under the impression that simply doing Logger.getLogger() was > perfectly adequate for a professional quality program. Why would LogManager > be any better than simply making the logger a class variable? Loggers are cached by default. I have only used LogManager when I wanted to work with the config. Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Question about loggers Novice <novice@example..com> - 2012-03-07 21:52 +0000
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 17:16 -0500
Re: Question about loggers Novice <novice@example..com> - 2012-03-07 23:57 +0000
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 19:24 -0500
Re: Question about loggers Lew <noone@lewscanon.com> - 2012-03-08 07:22 -0800
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 10:27 -0500
Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-08 11:58 -0800
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 15:49 -0500
Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-08 08:15 -0800
Re: Question about loggers markspace <-@.> - 2012-03-08 10:05 -0800
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 13:50 -0500
Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-09 07:11 -0800
Re: Question about loggers Lew <noone@lewscanon.com> - 2012-03-09 07:45 -0800
Re: Question about loggers markspace <-@.> - 2012-03-09 07:54 -0800
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 11:03 -0500
Re: Question about loggers markspace <-@.> - 2012-03-09 09:10 -0800
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 12:27 -0500
Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-09 10:56 -0800
Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-09 20:29 +0100
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 11:04 -0500
Re: Question about loggers markspace <-@.> - 2012-03-09 09:14 -0800
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 12:22 -0500
Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-09 10:58 -0800
Re: Question about loggers markspace <-@.> - 2012-03-07 15:21 -0800
Re: Question about loggers Novice <novice@example..com> - 2012-03-08 00:01 +0000
Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 19:21 -0500
Re: Question about loggers Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-08 06:18 -0400
csiph-web