try{...} catch (Exception e) { e.printStackTrace(); rspCode = String.valueOf(BaseException.RSP_SYS_ERROR_CODE); try { // TODO 发送邮件预警 StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw, true)); String str = sw.toString(); String text = "账户: " + account + ", 代码: " + rspCode + "<br> 信息: " + str; emailService.sendBatchMail(MailUtil.mailto, "warning", text, "登录失败预警"); } catch (Exception e2) { e2.printStackTrace(); } } finally { ...}
使用StringWriter获取异常内容
猜你喜欢
转载自yanxiaojia.iteye.com/blog/1988469
今日推荐
周排行