请建议我如何用 log.error 替换 printstacktace 行
public class extends Throwable {
private Throwable _prev;
public synchronized Throwable getPrevThrowable() {
return _prev;
}
public void printStackTrace(PrintStream ps) {
super.printStackTrace(ps);
Throwable t;
if ((t = getPrevThrowable()) != null) {
t.printStackTrace(ps);
}
}
我可以像下面那样实现它吗?
public class extends Throwable {
public void printStackTrace(PrintStream ps) {
log.error(ps);
Throwable t;
if ((t = getPrevThrowable()) != null) {
log.error(t);
}
}