Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: analysis of java application logs Date: Tue, 24 May 2011 12:26:00 -0400 Organization: albasani.net Lines: 40 Message-ID: References: <941ivgF1amU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net E3qm1u5FZ2tVI+pTw7Qrqr9GsnLWTnRkbQFClx3OhuefMv7hoZMcnO6y2Mcjdv+zl8VJ3pDMNRtN3fLbIgFMmHQ/aHkNuBf5jFCC8gGzhvxRd7mm07G4xLVlgUl7kkIF NNTP-Posting-Date: Tue, 24 May 2011 16:25:37 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="jFP1gu+R0SLacLmvkQrV6jmqRm+C7YKhpHhH4IK0PHa9TjL6tklyyI8WeMGMTGIPuBLAvXq0FCXsHRgcVb9WQ03CzfDP0ZvbYCm1Qcpmwws908xt9KnaUb02CaB3wO4U"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:mlAOADAtWaYklZuQ1ColIDLl8II= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4539 Martin Gregorie wrote: > 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. Seems like it's a simple equality test that would be HotSpotted away. > 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. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg