You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Geir Magnusson Jr <ge...@pobox.com> on 2006/06/01 05:56:32 UTC

Re: [classlib] logging from within our implementation


Anton Luht wrote:
> 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 :)
> 

Yah.  I'd rather see us add the logging this way rather than removing 
it, using annotations or aspects or something... I'll try to experiment 
with this tomorrow.

I really hate discussing logging.  It's impossible to have a short 
conversation where everyone agrees.  Yoko, the CORBA project in the 
incubator, is going through a very similar issue...

geir

> On 31 May 2006 19:24:18 +0700, Egor Pasko <eg...@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


Re: [offlist] Re: [classlib] logging from within our implementation

Posted by Leo Simons <ma...@leosimons.com>.
On Mon, Jun 05, 2006 at 11:17:50AM +0100, Tim Ellison wrote:
> [Eek!  ok so you can see that wasn't intended to go onto the list]

FWIW and IMVHO, this kind of thing is entirely appropriate on-list :-)

> Apologies for embarrassing George (... but buy the book anyway<g>)

I just might!

> Tim Ellison wrote:
> > Talk to George, he's a world expert on Aspects
> > 
> > (and co-author of a book on the subject)
> > http://www.amazon.com/gp/product/0321245873/qid=1149502393/sr=1-1/ref=sr_1_1/102-7435876-8007311?s=books&v=glance&n=283155
> > 
> > Regards,
> > Tim
> > 
> > 
> > Geir Magnusson Jr wrote:
> >> Stefano Mazzocchi wrote:
> >>
> >>> Maybe we should start thinking more with that in mind and think about
> >>> scratching our own itches in terms of development... we might find some
> >>> serious innovation on the way to there.
> >>>
> >> I think the disagreement boils down to defining the "itch".  I'm not
> >> interested in the overhead because while we will own the VM for our
> >> distro, it's still overhead and additionally, we want others w/ VMs to
> >> use our classlibrary too (like Sun, BEA, IBM, Apple... )
> >>
> >> I'm going to dork around w/ aspects to see if we can make the addition
> >> of debugging a pre-processing step used by people that want to debug...
> >>
> >> geir

-- 

LSD

---------------------------------------------------------------------
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


Re: [offlist] Re: [classlib] logging from within our implementation

Posted by Tim Ellison <t....@gmail.com>.
[Eek!  ok so you can see that wasn't intended to go onto the list]

Apologies for embarrassing George (... but buy the book anyway<g>)

Tim

Tim Ellison wrote:
> Talk to George, he's a world expert on Aspects
> 
> (and co-author of a book on the subject)
> http://www.amazon.com/gp/product/0321245873/qid=1149502393/sr=1-1/ref=sr_1_1/102-7435876-8007311?s=books&v=glance&n=283155
> 
> Regards,
> Tim
> 
> 
> Geir Magnusson Jr wrote:
>> Stefano Mazzocchi wrote:
>>
>>> Maybe we should start thinking more with that in mind and think about
>>> scratching our own itches in terms of development... we might find some
>>> serious innovation on the way to there.
>>>
>> I think the disagreement boils down to defining the "itch".  I'm not
>> interested in the overhead because while we will own the VM for our
>> distro, it's still overhead and additionally, we want others w/ VMs to
>> use our classlibrary too (like Sun, BEA, IBM, Apple... )
>>
>> I'm going to dork around w/ aspects to see if we can make the addition
>> of debugging a pre-processing step used by people that want to debug...
>>
>> geir
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
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


Re: [offlist] Re: [classlib] logging from within our implementation

Posted by Geir Magnusson Jr <ge...@pobox.com>.
Cool - he can tell us how it's done then :)

geir

Tim Ellison wrote:
> Talk to George, he's a world expert on Aspects
> 
> (and co-author of a book on the subject)
> http://www.amazon.com/gp/product/0321245873/qid=1149502393/sr=1-1/ref=sr_1_1/102-7435876-8007311?s=books&v=glance&n=283155
> 
> Regards,
> Tim
> 
> 
> Geir Magnusson Jr wrote:
>> Stefano Mazzocchi wrote:
>>
>>> Maybe we should start thinking more with that in mind and think about
>>> scratching our own itches in terms of development... we might find some
>>> serious innovation on the way to there.
>>>
>> I think the disagreement boils down to defining the "itch".  I'm not
>> interested in the overhead because while we will own the VM for our
>> distro, it's still overhead and additionally, we want others w/ VMs to
>> use our classlibrary too (like Sun, BEA, IBM, Apple... )
>>
>> I'm going to dork around w/ aspects to see if we can make the addition
>> of debugging a pre-processing step used by people that want to debug...
>>
>> geir
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 

---------------------------------------------------------------------
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


[offlist] Re: [classlib] logging from within our implementation

Posted by Tim Ellison <t....@gmail.com>.
Talk to George, he's a world expert on Aspects

(and co-author of a book on the subject)
http://www.amazon.com/gp/product/0321245873/qid=1149502393/sr=1-1/ref=sr_1_1/102-7435876-8007311?s=books&v=glance&n=283155

Regards,
Tim


Geir Magnusson Jr wrote:
> 
> Stefano Mazzocchi wrote:
> 
>> Maybe we should start thinking more with that in mind and think about
>> scratching our own itches in terms of development... we might find some
>> serious innovation on the way to there.
>>
> 
> I think the disagreement boils down to defining the "itch".  I'm not
> interested in the overhead because while we will own the VM for our
> distro, it's still overhead and additionally, we want others w/ VMs to
> use our classlibrary too (like Sun, BEA, IBM, Apple... )
> 
> I'm going to dork around w/ aspects to see if we can make the addition
> of debugging a pre-processing step used by people that want to debug...
> 
> geir
> 
> ---------------------------------------------------------------------
> 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
> 
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
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


Re: [classlib] logging from within our implementation

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Stefano Mazzocchi wrote:

> 
> Maybe we should start thinking more with that in mind and think about
> scratching our own itches in terms of development... we might find some
> serious innovation on the way to there.
> 

I think the disagreement boils down to defining the "itch".  I'm not
interested in the overhead because while we will own the VM for our
distro, it's still overhead and additionally, we want others w/ VMs to
use our classlibrary too (like Sun, BEA, IBM, Apple... )

I'm going to dork around w/ aspects to see if we can make the addition
of debugging a pre-processing step used by people that want to debug...

geir

---------------------------------------------------------------------
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


Re: [classlib] logging from within our implementation

Posted by Stefano Mazzocchi <st...@apache.org>.
Vladimir Gorr wrote:
> We need to remember the class file transformation via BCEL implies the
> performance degradation at load-time.
> IMO using the source code like this
> 
> *static final boolean DEBUG = false;
> if (DEBUG) {
>   // wiped away by java compiler
>   log("my useful log message");
> }
> *
> will give better performance but demands the additional efforts for the
> re-factoring the source code.

People,

in case you have forgotten, we are writing a virtual machine, which
means we can practically do anything, including externally triggered
runtime bytecode modification. Aspect injection, whatever.

I've seen a presentation of JRockit's management console and they seem
to be able to do stuff like that (I need to play more)

As much as I'm a proud printf kind of guy, I never had the luxury of
owning the keys to the internals of the machine that ran my code.

Maybe we should start thinking more with that in mind and think about
scratching our own itches in terms of development... we might find some
serious innovation on the way to there.

-- 
Stefano.


---------------------------------------------------------------------
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


Re: [classlib] logging from within our implementation

Posted by Vladimir Gorr <vv...@gmail.com>.
We need to remember the class file transformation via BCEL implies the
performance degradation at load-time.
IMO using the source code like this

*static final boolean DEBUG = false;
if (DEBUG) {
   // wiped away by java compiler
   log("my useful log message");
}
*
will give better performance but demands the additional efforts for the
re-factoring the source code.

Thanks,
Vladimir.

On 6/1/06, Anton Luht <an...@gmail.com> wrote:
>
> Alexei,
>
> I've suggested BCEL but not ASM because it is an Apache product and
> its license certainly fits Harmony and the author tells that he used
> BCEL before.
>
> I've used it a couple of times and everything worked just fine. No
> code corruptions ever happened. It is mentioned in Sun Developer
> Network JavaOne Online Technical Sessions. Seems like it's a mature
> tool (even judging by version - 5.1 :) ).
>
> On 6/1/06, Alexei Zakharov <al...@gmail.com> wrote:
> > As far as I understand they use ObjectWEb ASM rather than BCEL in
> > their example. But in any case, this approach implies trust in these
> > code-manipulation libraries. Does it stable enough? Can't it produce
> > corrupted byte-code?
>
> --
> Regards,
> Anton Luht,
> Intel Middleware Products Division
>
> ---------------------------------------------------------------------
> 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
>
>

Re: [classlib] logging from within our implementation

Posted by Anton Luht <an...@gmail.com>.
Alexei,

I've suggested BCEL but not ASM because it is an Apache product and
its license certainly fits Harmony and the author tells that he used
BCEL before.

I've used it a couple of times and everything worked just fine. No
code corruptions ever happened. It is mentioned in Sun Developer
Network JavaOne Online Technical Sessions. Seems like it's a mature
tool (even judging by version - 5.1 :) ).

On 6/1/06, Alexei Zakharov <al...@gmail.com> wrote:
> As far as I understand they use ObjectWEb ASM rather than BCEL in
> their example. But in any case, this approach implies trust in these
> code-manipulation libraries. Does it stable enough? Can't it produce
> corrupted byte-code?

-- 
Regards,
Anton Luht,
Intel Middleware Products Division

---------------------------------------------------------------------
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


Re: [classlib] logging from within our implementation

Posted by Alexei Zakharov <al...@gmail.com>.
As far as I understand they use ObjectWEb ASM rather than BCEL in
their example. But in any case, this approach implies trust in these
code-manipulation libraries. Does it stable enough? Can't it produce
corrupted byte-code?

2006/6/1, Geir Magnusson Jr <ge...@pobox.com>:
>
> Anton Luht wrote:
> > 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 :)
>
> Yah.  I'd rather see us add the logging this way rather than removing
> it, using annotations or aspects or something... I'll try to experiment
> with this tomorrow.

---
Alexei Zakharov,
Intel Middleware Product Division

---------------------------------------------------------------------
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