What slows it down 7 fold? Is it
Logger.fine(something) versus Logger.log(Level.FINE, something)
Or is it concatenation versus having logger fill-in the {0}
????????????
On 7/26/2011 11:02 AM, Bobby Bissett wrote:
> On 7/26/11 12:52 PM, 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....
>
> They're both slower than:
>
> if (logger.isLoggable(Level.FINE)) {
> // now log something that requires an operation
> }
>
> "Don't do that." :)
>
> Cheers,
> Bobby
>
--
Oracle <http://www.oracle.com>
Byron Nevins | Principal MTS
Phone: +1 6503958992 <tel:+1%206503958992>
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment