There's work done to remove code from Java class files at load time to
support the new assert feature in JDK1.4.  IIRC the class loader is doing
most if not all of the work.  So it may be possible to make it work in
earlier JDKs.  Could something similiar be done for logging?

Jin Yu

-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 7:09 PM
To: [EMAIL PROTECTED]
Subject: Re: [TC4.0] Disabling debug output...




On Thu, 19 Jul 2001, Jonathan Reichhold wrote:

> > This hack definitely works.  As long as you're willing to pay the
overhead
> > for the method call, it's essentially equivalent to asking Log4J whether
> > or not debugging output is enabled, which does something similar (but
asks
> > the instantiated logger object, instead of being a static method).
> 
> I'm not sure if Log4j has an accesible boolean like this (maybe it
> does, haven't used it yet),

It's accessible, but via a method call.  That's still a *lot* cheaper than
doing useless string concatenations, but not quite as cheap as an integer
comparison.  I don't have the Log4J APIs available right at the moment,
but there's a call on the logger object that can be used to check for
enabled levels (or at least for debug).

Craig McClanahan
Enterprise Channel Management Software for Manufacturers 
Visit us at http://www.ultryx.com 

Reply via email to