dev@glassfish.java.net

Re: Please remember to wrap logger.finest calls

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Fri, 11 Sep 2009 12:50:02 -0700

That looks ghastly! Why not add toString() or something like it to hide
that mess?


Kedar Mhaswade wrote:
> Jan Luehe wrote:
>> I am seeing several places in the GlassFish v3 code where logging at
>> FINEST level
>> is not wrapped inside "if (logger.isLoggable(Level.FINEST))".
>>
>> For example (in monitoring):
>>
>> logger.finest(
>> "[TM]requestStartEvent Unprocessed received - virtual-server =
>> " +
>> request.getServerName() + ":" + request.getServerPort() +
>> ": application = " + request.getContextPath() +
>> " : servlet = " + request.getServletPath() +
>> " : Expecting (vsName, appName) = (" +
>> virtualServerName + ", " + moduleName + ")");
>>
>> This will cause the logging message to be assembled even at the
>> default INFO level, where it won't be logged!
>>
>> Please remember to wrap, as follows:
>>
>> if (logger.isLoggable(Level.FINEST)) {
>> logger.finest(...);
>> }
>
> Great point, Jan!
>
> Does anyone know if Findbugs catches these?
>
>>
>> Thanks!
>>
>> Jan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>