scala 将异常信息完成输出到日志中

2019-03-14 15:53:38 浏览数 (1)

scala 将异常信息完成输出到日志中

/** * scala 将异常信息完成输出到日志中 * @param e * @param data */ def printStackTraceStr(e: Exception, data: String) = { val sw:StringWriter = new StringWriter() val pw:PrintWriter = new PrintWriter(sw) e.printStackTrace(pw) println("======>>printStackTraceStr Exception: " e.getClass() "n==>" sw.toString () "n==>data=" data) }

0 人点赞