Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.erje.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: analysis of java application logs Date: Tue, 24 May 2011 14:37:52 +0000 (UTC) Organization: UK Free Software Network Lines: 40 Message-ID: References: <941ivgF1amU1@mid.individual.net> 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 1306247872 20781 84.45.235.129 (24 May 2011 14:37:52 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Tue, 24 May 2011 14:37:52 +0000 (UTC) User-Agent: Pan/0.133 (House of Butterflies) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4536 On Tue, 24 May 2011 08:49:52 -0400, Lew wrote: > Martin Gregorie wrote: >> Fair point. However, my usual debugging statement takes the form: >> >> if (debug> 0) >> debugger.trace(result + " = method(" + arg + ")"); >> >> Ugly, I know, but quite efficient, since when debugging is off even the >> cost of the method call cost is. I use an integer to control debugging >> rather than a boolean so I can control its volume: "java Application >> -dd" would be expected to provide more detailed debugging output than >> "java Application -d" >> >> > What's wrong with > > if ( logger.isDebugEnabled() ) ... > > or > > if ( logger.getLevel().isGreaterOrEqual( Logger.DEBUG )) ... > ? > Not a lot, though that does involve method call overheads that you may not want in a tight loop. I initially created my simple ReportError logging class for Java 1.3, before the Logger class was introduced, and, as it does what I need, have seen no need to replace it. It was written to provide similar Java functionality to a set of C functions that I'd been using for many years. Its trace() methods are roughly equivalent to Logger.log(Level, String) and Logger.log(Level, String, Object[]) with all output sent to stderr. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |