Hi all,

How about using Velocity as Preprocessor.
You could put all logging Statements between an
//#if ($debug)
and
//#end
So the Code would stay pure java, and the debug Version could be compiled
without a Preprocessor.

Regards,
Soeren


Anton Luht schrieb:
It is possible to remove all calls to logging below a certain level
from .class files using BCEL:
http://surguy.net/articles/removing-log-messages.xml . In this example
logging is removed on fly when class is loaded, but this tool can be
run against class files in the process of building release version.
For example, debug version can contain all logging and release - only
errors. This approach has one disadvantage: it is non-standard and
looks like a dirty hack :)

On 31 May 2006 19:24:18 +0700, Egor Pasko <[EMAIL PROTECTED]> wrote:
On the 0x17A day of Apache Harmony Alex Blewitt wrote:
> Moral 1: saying 'It's OK, debug logging can be turned off and
> log.debug(msg) is inexpensive' is a lie. If you really feel the need
> for sprinkling debug statements everywhere (and I'm with others in
> using a good IDE to track down problems) then surround every debug
> with if (log.debugEnabled()) { log.debug(msg) }. Yes, it has the same
> effect, but at least you don't bother wasting the calcuation of the
> message itself, and in this case, even a dozy JIT can optimise it
> away.

+1 for log.debugEnabled() :)



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to