harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Volosyuk" <ivan.volos...@gmail.com>
Subject Re: [classlib] logging from within our implementation
Date Tue, 30 May 2006 20:46:55 GMT
2006/5/31, Gregory Shimansky <gshimansky@gmail.com>:
> On Wednesday 31 May 2006 00:09 Ivan Volosyuk wrote:
> > I am not sure, we can say someday: Yes, the code is absolutely bug
> > free! Remove the logging!
> >
> > I have a suggestion, which can help leave logging in place while still
> > having no impact on performance. The logging can be used for debuging
> > of features and will be removed in release version. It require some
> > changes to build system though.
> >
> > The idea is quite simple: we can use C preprocessor directives in java
> > files. When building the preprocessor will be executed before java
> > compiler (if the source-file's timestamp was changed). Thus we can
> > have logger-free release builds and debug builds with full weight
> > logging.
> I have a simpler suggestion which doesn't require any tools foreign to java.
> Make classlib debugging infrastructure internal class, not java.util.logging,
> but an internal wrapper to classes in java.util.logging. And in release
> version all its methods should be empty.
> Any good behaving optimizing runtime would inline empty methods into nothing
> and therefore no performance impact would be made.

Excelent! This is much better and simplier.

public final class CLogger {
   public static void msg(Object... ) {..}

Hmm, I see one drawback of this approach: arguments will still be
evaluated even if logger itself will be empty. So, some care needed to
maintain performance with such logger.

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