java 获取全部日志日志

 

 

复制代码
public static String getExceptionAllInfo(Exception ex) {
ByteArrayOutputStream out = null;
PrintStream pout = null;
String ret = "";
try {
out = new ByteArrayOutputStream();
pout = new PrintStream(out);
ex.printStackTrace(pout);
ret = new String(out.toByteArray());
out.close();
}catch(Exception e){
return ex.getMessage();
}finally{
if(pout!=null){
pout.close();
}
}
return ret;
}
复制代码

 

posted @   韦邦杠  阅读(9)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示