[slf4j-user] what is the fastest way of logging an info message?

pengfei shen shpfei at gmail.com
Thu Sep 2 07:29:11 CEST 2010


i am a developer and i need your help.
log a debug message, the recommend way as follow ,
   logger.debug("The entry is {}.", entry);
it is more efficiency.Because it avoids the cost of parameter
constructionif the debug is disabled for logger.
but if i want to log an info message ,which of the two way is better?
logger.info("The entry is {}.", entry);
or
logger.info("The entry is " + entry+".");

because my system's log level always is info,so "avoids the cost of
parameter construction" such problem is not exist, but the first way
logger.info("The entry is {}.", entry)
seems like that it needs more work to do than the second way,for example it
needs to find the "{}" at least. And i guess it's directly output the string
without matching the "{}" in the second way.
so in that situation, i think the second way is better.
is that right?


waiting for your answers
thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20100902/a18e573e/attachment.html>


More information about the slf4j-user mailing list