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

Jarod Liu liuyuanzhi at gmail.com
Tue Sep 23 02:26:17 CEST 2008


Ceki:
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.
The JDK version I using is 1.6.0_7

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 ?


On Tue, Sep 23, 2008 at 5:08 AM, Ceki Gulcu <listid at qos.ch> wrote:

> 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
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://www.slf4j.org/mailman/listinfo/user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20080923/6bf2204e/attachment.htm>


More information about the slf4j-user mailing list