dev@glassfish.java.net

Re: Please consider avoiding concatenated log messages

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Tue, 26 Jul 2011 10:58:26 -0700

Or you put if (logger.isLoggable(Level.FINE)) around it. The string
concatenation is done before checking for the log level...

-marina

Vince Kraemer wrote:
> Hi all,
>
> I noticed some lines (about 1350) like this
>
> logger.fine("some message: " + varForDetail);
>
> in our code.
>
> This is 'equal to'
>
> logger.log(Level.FINE, "some message: {0}", varForDetail);
>
> but it seems like this second form is about 7 times faster to execute,
> if the logging level is Level.INFO....
>
> vbk