[slf4j-user] [bug report]stack trace content lost

Ceki Gulcu listid at qos.ch
Mon Sep 22 23:08:27 CEST 2008


Hello Jarod,

Which JDK are you using? On JDK 1.5.0, I see

java.lang.ClassCastException: java.lang.String
	

What happens when you change the while loop to

  while (true) {
    try {
      Integer a = (Integer) m.get("a");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }


Jarod Liu wrote:
> Hi all,
> I use slf4j(1.5.2) + logback(0.9.9) to do logging in my applications. I 
> enouter a problem, while the load of logging going up, slf4j/logback 
> well lost stack trace of a exception.  Below is my test program and the 
> test output
> 
> 
> 
> correct output:
> ----------------------------------------
> 11:33:38 ERROR [main]log.Logback.main -
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.lang.Integer
>     at log.Logback.main(Logback.java:31)
> 
> after some time, output turns to as below:
> --------------------------------------
> 11:44:18 ERROR [main]log.Logback.main -
> java.lang.ClassCastException
> 
> 
> 
> test program:
> 
> public class Logback {
> 
>     private static Logger logger = LoggerFactory.getLogger(Logback.class);
> 
> 
>     public static void main(String[] args) {
>         Map m = new HashMap();
>         m.put("a", "dsfd");
> 
>         while (true) {
>             try {
>                 Integer a = (Integer) m.get("a");
> 
>             } catch (Exception e) {
>                 logger.error("", e);
>             }
>         }
>     }
> }
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://www.slf4j.org/mailman/listinfo/user

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list