<div dir="ltr">Ceki:<br>Thanks for your reply. You got the point. After change the output statement to e.printStackTrace() the problem still there, it is not about slf4j or logback. <br>The JDK version I using is 1.6.0_7<br>
<br>Maybe this is a bug of JDK or this is some kind of optimization. If it is a optimization, do someone knows how to turn it off ?<br><br><br><div class="gmail_quote">On Tue, Sep 23, 2008 at 5:08 AM, Ceki Gulcu <span dir="ltr"><listid@qos.ch></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Jarod,<br>
<br>
Which JDK are you using? On JDK 1.5.0, I see<br>
<div class="Ih2E3d"><br>
java.lang.ClassCastException: java.lang.String<br>
<br>
<br>
</div>What happens when you change the while loop to<br>
<div class="Ih2E3d"><br>
while (true) {<br>
try {<br>
Integer a = (Integer) m.get("a");<br>
} catch (Exception e) {<br>
</div> e.printStackTrace();<br>
<div><div></div><div class="Wj3C7c"> }<br>
}<br>
<br>
<br>
Jarod Liu wrote:<br>
> Hi all,<br>
> I use slf4j(1.5.2) + logback(0.9.9) to do logging in my applications. I<br>
> enouter a problem, while the load of logging going up, slf4j/logback<br>
> well lost stack trace of a exception. Below is my test program and the<br>
> test output<br>
><br>
><br>
><br>
> correct output:<br>
> ----------------------------------------<br>
> 11:33:38 ERROR [main]log.Logback.main -<br>
> java.lang.ClassCastException: java.lang.String cannot be cast to<br>
> java.lang.Integer<br>
> at log.Logback.main(Logback.java:31)<br>
><br>
> after some time, output turns to as below:<br>
> --------------------------------------<br>
> 11:44:18 ERROR [main]log.Logback.main -<br>
> java.lang.ClassCastException<br>
><br>
><br>
><br>
> test program:<br>
><br>
> public class Logback {<br>
><br>
> private static Logger logger = LoggerFactory.getLogger(Logback.class);<br>
><br>
><br>
> public static void main(String[] args) {<br>
> Map m = new HashMap();<br>
> m.put("a", "dsfd");<br>
><br>
> while (true) {<br>
> try {<br>
> Integer a = (Integer) m.get("a");<br>
><br>
> } catch (Exception e) {<br>
> logger.error("", e);<br>
> }<br>
> }<br>
> }<br>
> }<br>
><br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> user mailing list<br>
> <a href="mailto:user@slf4j.org">user@slf4j.org</a><br>
> <a href="http://www.slf4j.org/mailman/listinfo/user" target="_blank">http://www.slf4j.org/mailman/listinfo/user</a><br>
<font color="#888888"><br>
--<br>
Ceki Gülcü<br>
Logback: The reliable, generic, fast and flexible logging framework for Java.<br>
<a href="http://logback.qos.ch" target="_blank">http://logback.qos.ch</a><br>
_______________________________________________<br>
user mailing list<br>
<a href="mailto:user@slf4j.org">user@slf4j.org</a><br>
<a href="http://www.slf4j.org/mailman/listinfo/user" target="_blank">http://www.slf4j.org/mailman/listinfo/user</a><br>
</font></blockquote></div><br></div>