try{ .................... } catch(Exception e){ //定义一个流 ByteArrayOutputStream ostr = new ByteArrayOutputStream(); //把错误堆栈储存到流中 e.printStackTrace(new PrintStream(ostr)); //打印.... out.println(ostr.toString()); }
时间: 2024-10-31 14:24:49
try{ .................... } catch(Exception e){ //定义一个流 ByteArrayOutputStream ostr = new ByteArrayOutputStream(); //把错误堆栈储存到流中 e.printStackTrace(new PrintStream(ostr)); //打印.... out.println(ostr.toString()); }