admin@glassfish.java.net

Re: CODE REVIEW: FindBugs: admin/validator/src/java/com/sun/enterprise/config/serverbeans/validation/Result.java

From: Kedar Mhaswade <Kedar.Mhaswade_at_Sun.COM>
Date: Fri, 04 May 2007 11:01:10 -0700

Bill Shannon wrote:
> Kedar Mhaswade wrote:
>>
>>>> - boolean debug = false;
>>>> + final boolean debug = false;
>>>
>>> There doesn't seem to be any actual use of debug, why not just
>>> remove it?
>> I agree. Plus there is no way to debug the code without actually
>> recompiling code
>> with this variable set to true.
>>
>> A better way to do this is: private final boolean debug =
>> Boolean.getBoolean("debug");
>>
>> Unfortunately, we have this pattern in code at several places ...
>
> Shouldn't that generally be replaced by use of a Logger?
I agree. All printlns can be effectively replaced by
e.g. Logger.getLogger(adminLogger).fine("a debug statement");

But I have read that this should be preceded by
Logger.isLoggable(Level.FINE) and we are lazy :(

Actually, it makes a lot of sense to use Logger because changes to the
logging levels of a logger are
dynamic. So, you can easily make a logger log records at "FINE" even if
its initial level is "INFO".
This is a significant GlassFish feature.

In spite of all this, system.out.printlns are way more popular with
GlassFish developers :)

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>