<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Century Gothic";
        panose-1:2 11 5 2 2 2 2 2 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Kristian – yes, when adding two strings together, java does that automatically because the new concatenated string is the actual parameter you are passing, so it happens before you enter the log method. By using the varargs calling convention, the concatenation is postponed until after the method is entered.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Best regards,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Century Gothic","sans-serif";color:#1f497d">Richard Sand | Managing Director</span><span style="font-size:11.0pt;font-family:"Century Gothic","sans-serif";color:#1f497d"> <br>
</span><span style="font-size:9.0pt;font-family:"Century Gothic","sans-serif";color:#595959">PO Box 91824 | Austin | Texas 78709-1824 | USA <br>Office: +1 888 612 8820 ext 02 | Fax: +1 866 304 3754<br>
Mobile: +1 267 984 3651</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Calibri","sans-serif";color:#595959"><img width="243" height="31" id="Picture_x0020_1" src="cid:image001.jpg@01CE0552.89C688F0" alt="logo - small"></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:logback-user-bounces@qos.ch">logback-user-bounces@qos.ch</a> [mailto:<a href="mailto:logback-user-bounces@qos.ch">logback-user-bounces@qos.ch</a>] <b>On Behalf Of </b>Kristian Lind<br>
<b>Sent:</b> Thursday, February 07, 2013 4:36 PM<br><b>To:</b> logback users list<br><b>Subject:</b> Re: [logback-user] commons-logging -> sl4j -> logback</span></p><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-bottom:12.0pt">
And that is of cause no matter if there is sl4j behind the commons-logging I guess ? </p><div><p class="MsoNormal">On Thu, Feb 7, 2013 at 1:11 PM, Brett Walker <<a href="mailto:brett.walker@geometryit.com" target="_blank">brett.walker@geometryit.com</a>> wrote:</p>
<div><div><p class="MsoNormal">With log.debug("The object is " + object), it will always call .toString() on object because the string argument needs to be constructed before the call to .debug().</p></div><div>
<p class="MsoNormal"> </p></div><div><p class="MsoNormal">To avoid this use either</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">  If (log.isDebugEnabled()) {</p></div><div><p class="MsoNormal">    Log.debug("The object is " + object);</p>
</div><div><p class="MsoNormal">  }</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Or the slf/logback usage</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">  Log.debug("The object is {0}", object);</p>
</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Which will delay the call to .toString() until it has determined that debug logging is needed.</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">
Brett<br><br>Sent from my iPad</p></div><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>On 08/02/2013, at 7:43 AM, "Kristian Lind" <<a href="mailto:klpcrap@gmail.com" target="_blank">klpcrap@gmail.com</a>> wrote:</p>
</div><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana","sans-serif"">In a previous project I switched from commons-logging -> log4j to sl4j -> logback. <br>
One of the reasons I did that was the overhead in log4j when providing a object in the log... <br>log.debug("This is a object" + object); <br>would cause the object.toString to be called even debug was not enabled. <br>
<br>Now I work on a new project that uses commons-logging -> sl4j -> logback (jcl-over-slf4j) <br><br>My question is now, will this still call object.toString.. even debug is not enabled <br><br>import org.apache.commons.logging.Log; <br>
import org.apache.commons.logging.LogFactory; <br>.... <br>log.debug("This is a object" + object); <br><br>I would like to get rid of commons-logging and jcl-over.sl4j and only have sl4j and logback.</span><br clear="all">
</p><div><p class="MsoNormal"> </p></div><p class="MsoNormal"> </p></div></blockquote></div></div><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal">_______________________________________________<br>
Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br><a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></p>
</div></blockquote></div><p class="MsoNormal"><br>_______________________________________________<br>Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br><a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></p>
</div><p class="MsoNormal"><br><br clear="all"></p><div><p class="MsoNormal"> </p></div><p class="MsoNormal">-- <br>Med venlig hilsen / Best regards<br><br>Kristian Lind</p></div></body></html>