on 6/6/01 9:23 AM, "David S. Faller" <[EMAIL PROTECTED]> wrote:

> What about something like:
> if (Log.getLogLevel() > Log.LEVEL_DEBUG) {
>   Log.debug("myMethod() entered. param1="+param1+";param2="+param2);
> }

Actually, that still doesn't work 100% well...here is some test
code...compile it and then run javap -c Test and you will see that using a
method like that does not compile out the code as you would hope it does...

import java.io.*;
import java.lang.*;
import java.util.*;

public class Test
{
    public static boolean getDebug()
    {
        return false;
    }

    public static void debug(String log_me) {
     if (getDebug()) {
         System.out.println(log_me);
     }
    }

    public static void main(String args[]) {
     if (getDebug()) debug("strings");
     debug("still");
     debug("in");
     debug("class");
     debug("file");
    }

}

A better solution is to do something like this:

if (Log.DEBUG && Log.getLogLevel() > Log.LEVEL_DEBUG )

We can then use Ant to do a <replace> in the .java code in the Log.java
class for the Log.DEBUG return value.

Feel free to submit a patch. :-)

-jon

-- 
"Open source is not available to commercial companies."
            -Steve Balmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to