如何停止在日志中截断堆栈跟踪 [英] How do I stop stacktraces truncating in logs

查看:22
本文介绍了如何停止在日志中截断堆栈跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Java 日志中,很多时候我会得到类似的信息:

Lots of times in Java logs I'll get something like:

Caused by: java.sql.BatchUpdateException: failed batch
    at org.hsqldb.jdbc.jdbcStatement.executeBatch(jdbcStatement.java:1102)
    at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(jdbcPreparedStatement.java:514)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
    ... 113 more

有谁知道如何显示完整的堆栈跟踪(即显示其他 113 行)?

Does anyone know how to get the full stacktrace showing (i.e. show the other 113 lines)?

JavaDocs(用于Java 7) for Throwable 对正在发生的事情有非常详细的解释.

The JavaDocs (for Java 7) for Throwable have a pretty detailed explanation of what's going on.

推荐答案

当您看到 '...113 more' 时,这意味着 'caused by' 异常的其余行与该点的其余行相同父异常.

When you see '...113 more', that means that the remaining lines of the 'caused by' exception are identical to the remaining lines from that point on of the parent exception.

例如,您将拥有

com.something.XyzException
  at ...
  at ...
  at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
  at ... <the other 113 lines are here>...
Caused by: <the above>.

两个堆栈跟踪在 AbstractBatcher.executeBatch 第 242 行相遇",然后从那时起向上调用跟踪与包装异常相同.

The two stack traces 'meet' at AbstractBatcher.executeBatch, line 242, and then from then on the upward call trace is the same as the wrapping exception.

这篇关于如何停止在日志中截断堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆