How do I stop stacktraces truncating in logs

后端 未结 6 1334
逝去的感伤
逝去的感伤 2020-11-27 17:39

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

Caused by: java.sql.BatchUpdateException: failed batch
    at org.hsqldb.jdbc.jdbcStatement.executeBatch         


        
6条回答
  •  臣服心动
    2020-11-27 18:08

    Apache's Commons Lang provides a nice util method ExceptionUtils.printRootCauseStackTrace() which prints a nested stacktrace 'upside down'. The result is much more intuitive.

    If you see the result next to the original out of the printStackTrace() method, it will be clear where the '113 more' lines went.

提交回复
热议问题