问题遇到的现象和发生背景
在try{}catch(){}中直接exception.printStackTrace();与log.error(exception)除了输出位置不同之外有没有其他区别?
比如输出结果上或者性能上
用代码块功能插入代码,请勿粘贴截图
public static void main(String[] args) {
try {
String txt = "";
String substring = txt.substring(1, 2);
} catch (Exception e) {
e.printStackTrace();
log.error("error:",e);
}
}