Please suggest me how to replace the printstacktace lines with log.error
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);
}
}
Can I implement it like below ??
public class extends Throwable {
public void printStackTrace(PrintStream ps) {
log.error(ps);
Throwable t;
if ((t = getPrevThrowable()) != null) {
log.error(t);
}
}
I'm not sure what getPrevThrowable() does but you can do