2006/5/31, Gregory Shimansky <[EMAIL PROTECTED]>:
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.
--
Ivan

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