Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: Aspect questions? Date: Sun, 26 Feb 2012 11:18:54 +0000 (UTC) Organization: UK Free Software Network Lines: 31 Message-ID: References: <4f496d47$0$289$14726298@news.sunsite.dk> NNTP-Posting-Host: 84.45.235.129 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: localhost.localdomain 1330255134 32061 84.45.235.129 (26 Feb 2012 11:18:54 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Sun, 26 Feb 2012 11:18:54 +0000 (UTC) User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:12358 On Sat, 25 Feb 2012 22:20:03 -0800, Lew wrote: > The logger being tied to the class (or its name) gives you class-level > control over the logger behavior at deployment time by adjustment of the > logging properties (or XML) configuration file. This is desirable. > That's an interesting approach, though not one that I use. I tend to prefer a single logger per process with an associated level attribute, and to sprinkle classes with logger calls specifying different levels so I can vary the logged detail depending on what I need to see. The minimal level may correspond to nothing more than reporting overall run statistics. Next level will log method exits and show call arguments plus return value. The level above that shows method entry and beyond that anything that might be relevant in the method internals: both of these are omitted unless the method is complex enough to require them. > The logging object size pays for itself in spades with its > functionality. > Agreed. I recently added the ability to cache logger messages in a circular buffer to mine: if enabled, anything that's not an error is merely added to the buffer, which is dumped ahead of outputting an error message. This can be a big help if you need to diagnose a rarely occurring problem in a long-running process - it beats scanning through a multi-megabyte log hands down. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |