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 @ 2024-07-29 15:54  韦邦杠  阅读(6)  评论(0编辑  收藏  举报