harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Soeren Strassfeld <nc-stras...@netcologne.de>
Subject Re: [classlib] logging from within our implementation
Date Wed, 31 May 2006 21:11:23 GMT
Hi all,

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


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 <egor.pasko@gmail.com> 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: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message