<div>Thanks Ceki..</div>
<div>&nbsp;</div>
<div>I agree my argument isn&#39;t great.&nbsp; I am trying to get you to see the light that implied throwables is a&nbsp;feature that you want to implement.&nbsp;</div>
<div>&nbsp;</div>
<div>Without it the projects I work on will have to stick with out internal logging api.</div>
<div>&nbsp;</div>
<div>The point I was making wasn&#39;t performance but code migration.&nbsp; Often the people who&nbsp;maintain the code are not as well versed as the people who&nbsp;created it.&nbsp; </div>
<div>&nbsp;</div>
<div>The point I was making with</div>
<div>&nbsp;</div>
<div>logger.debug(&quot;Here is the xml {}&quot;, largeXmlDocument, exception );<br>&nbsp;</div>
<div>Was that with implied exceptions that would be the equivalent of</div>
<div>&nbsp;</div>
<div>if ( logger.isDebugEnabled() ) {</div>
<div>&nbsp;&nbsp;&nbsp; logger.debug(&quot;Here is the xml &quot; + largeXmlDocument, exception );</div>
<div>}</div>
<div>&nbsp;</div>
<div>I agree given the current api&#39;s limitations that it is a time bomb and why I am asking for impied exception feature.&nbsp; </div>
<div>&nbsp;</div>
<div>We have a large number of developers that will undoubtedly think that slf4j is like our existing internal api and make the mistake we both agree is a mistake...</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><span class="gmail_quote">On 9/6/07, <b class="gmail_sendername">Ceki Gulcu</b> &lt;<a href="mailto:ceki@qos.ch">ceki@qos.ch</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Glen,<br><br><br>When I first read your message, for a second I was worried that<br>SLF4J&#39;s current API would allow inadvertent hiding exceptions.
<br><br>However, your example<br><br>logger.debug(&quot;Here is the xml ...&quot;+ largeXmlDocument , exception );<br><br>is *not* concerned with hidden exceptions but with performance. To be<br>honest, I must say that I am not totally convinced. Exceptions are by
<br>definition exceptional meaning that they do not occur frequently. If<br>they don&#39;t occur frequently, performance is not such a big<br>issue. Would you agree?<br><br>However, if for some reason the exception is thrown frequently, you&#39;d
<br>pay they cost of converting the &quot;largeXmlDocument&quot; to String even if<br>the log statement was disabled.<br><br>I find the following case more troublesome:<br><br>logger.debug(&quot;Here is the xml {}&quot;, largeXmlDocument, exception );
<br><br>The exception would be swallowed by the current API. Now, imho that&#39;s<br>a timebomb waiting to happen.<br><br><br><br>Glen Marchesani wrote:<br>&gt;<br>&gt; Thanks for your answer Ceki.&nbsp;&nbsp;Your response is very clear.&nbsp;&nbsp;I hadn&#39;t
<br>&gt; realized that this should have been targeted at the SLF4J list thanks<br>&gt; for answering it anyway.&nbsp;&nbsp;If you want I can join the SLF4J mailing list<br>&gt; and ask it there.<br>&gt;<br>&gt; I agree it is not a serious limitation.&nbsp;&nbsp;It is a subtle limitation.&nbsp;&nbsp;I
<br>&gt; am an architect on a large project and we always have to choose the more<br>&gt; intuitive route with fewer subtle pitfalls since all developer&#39;s won&#39;t<br>&gt; be logging nuts and understand the very subtle differences between the
<br>&gt; two examples.<br>&gt;<br>&gt; Take this<br>&gt;<br>&gt; logger.debug(&quot;Here is the xml for the service request\n {} &quot;,<br>&gt; largeXmlDomDocument );<br>&gt;<br>&gt;<br>&gt; and turn it into this to add an exception
<br>&gt;<br>&gt; logger.debug(&quot;Here is the xml for the service request\n&quot; +<br>&gt; largeXmlDomDocument , exception );<br>&gt;<br>&gt; This could be a time bomb waiting to happen on a production system with<br>&gt; debug logging turned off.&nbsp;&nbsp;A very hard to trace performance hit since
<br>&gt; the lines of code are so seemingly the same.&nbsp;&nbsp;Of the 16 people on our<br>&gt; team I would say only 2 developer&#39;s would actually be able to catch that<br>&gt; and cite it as a change that is a potential performance hit.
<br>&gt;<br>&gt; I completely understand the necessity of not making changes to a core<br>&gt; api lightly.&nbsp;&nbsp;What about having inferred throwables be a system property<br>&gt; (or some form of config setting)?<br>&gt;<br>
&gt;<br>&gt;<br>&gt;<br>&gt; On 9/3/07, *Ceki Gulcu* &lt;<a href="mailto:listid@qos.ch">listid@qos.ch</a> &lt;mailto:<a href="mailto:listid@qos.ch">listid@qos.ch</a>&gt;&gt; wrote:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Hi Glen,<br>&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Thanks for sharing your idea. I think it makes sense. As you<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; observer, the<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; current API cannot deal with parameterized logging in conjunction<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; with exceptions.<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; However, I do not think it&#39;s a serious limitation because:
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 1) when confronted with exceptions, the performance of evaluating<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; whether to log<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; or not is not that important (as you usually would want to log)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 2) if for some odd reason you need the performance in case of
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; exceptions, you<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; can always write<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; if(logger.isErrorEnabled()) {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;User name [&quot;+name+&quot;] does not match&quot;, exception);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; In summary, although the current API is completely coherent, it<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; meets most<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; needs. More importantly, since logback&#39;s core logging API derives<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; from SLF4J, we<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; cannnot change logback&#39;s behavior without also changing SLF4J which
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I am not<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; keen to do. :-)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Does the above make sense?<br>&gt;<br>&gt;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Glen Marchesani wrote:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; I love the project and am glad to see the new features added to
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; logging<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; in general.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; I am willing to write a patch for a feature but before I do I<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; want to<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; make sure it is something you would be interested in.
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; There is no way to get a stack trace when using paramterized logging.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; The patch I want to add is that if the last parameter is a Throwable<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; then it gets passed to the fitlerAndLog() method as a thorable
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; (instead<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; of throwable being null).<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; To explain in code.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; log.debug( &quot;Something happened parm1={} parm2={} parm3={}&quot;, 1, 2,<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 3, new
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; Throwable() );<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; This would not cause the Throwable to be logged.&nbsp;&nbsp;So here are my<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; questions<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; - if I added the code to 
ch.qos.logback.classic.Logger is that<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; something<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; you are interested in?<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; - lacking that any recommendations on how to get this feature<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; built in.<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; Looking forward to your comments and thanks for the great work on a<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; great logging framework...<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; regards,<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; Glen
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ------------------------------------------------------------------------<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; _______________________________________________
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; logback-dev mailing list<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; <a href="mailto:logback-dev@qos.ch">logback-dev@qos.ch</a> &lt;mailto:<a href="mailto:logback-dev@qos.ch">logback-dev@qos.ch</a>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; <a href="http://qos.ch/mailman/listinfo/logback-dev">
http://qos.ch/mailman/listinfo/logback-dev</a><br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; --<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Ceki Gülcü<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Logback: The reliable, generic, fast and flexible logging framework<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; for Java.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://logback.qos.ch">
http://logback.qos.ch</a><br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; _______________________________________________<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; logback-dev mailing list<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:logback-dev@qos.ch">logback-dev@qos.ch</a> &lt;mailto:<a href="mailto:logback-dev@qos.ch">
logback-dev@qos.ch</a>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://qos.ch/mailman/listinfo/logback-dev">http://qos.ch/mailman/listinfo/logback-dev</a><br>&gt;<br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------
<br>&gt;<br>&gt; _______________________________________________<br>&gt; logback-dev mailing list<br>&gt; <a href="mailto:logback-dev@qos.ch">logback-dev@qos.ch</a><br>&gt; <a href="http://qos.ch/mailman/listinfo/logback-dev">
http://qos.ch/mailman/listinfo/logback-dev</a><br><br>--<br>Ceki Gülcü<br>Logback: The reliable, generic, fast and flexible logging framework for Java.<br><a href="http://logback.qos.ch">http://logback.qos.ch</a><br>_______________________________________________
<br>logback-dev mailing list<br><a href="mailto:logback-dev@qos.ch">logback-dev@qos.ch</a><br><a href="http://qos.ch/mailman/listinfo/logback-dev">http://qos.ch/mailman/listinfo/logback-dev</a><br></blockquote></div><br>