try{
......
}
catch(Exception e){
e.printStackTrace();
}
我想写一个Log,看看发生异常的时候具体的异常内容,但是不知道
怎么样得到这些异常。所以我用流写的时候不知道怎么读取异常信息。
比如能不能有象String error = e.printStackTrace();之类的,不行的话
怎么得到异常并传给error?
......
}
catch(Exception e){
e.printStackTrace();
}
我想写一个Log,看看发生异常的时候具体的异常内容,但是不知道
怎么样得到这些异常。所以我用流写的时候不知道怎么读取异常信息。
比如能不能有象String error = e.printStackTrace();之类的,不行的话
怎么得到异常并传给error?
e.printStackTrace(new PrintWriter(sw));
String error = sw.toString();
http://logging.apache.org/log4j/docs/download.html