Using the captured exception object, the commonly used APIs that can be called are
//获取异常信息,返回字符串。打印的实际上是异常产生的原因 (不使用)
String getMessage()
//获取异常类名和异常信息,返回字符串。 打印的是异常产生的原因和所在类 (不使用)
String toString()
//获取异常类名和异常信息,以及异常出现在程序中的位置 (推荐使用)
void printStackTrace()
//使用IO流,将异常内容保存在日志文件中,以便查阅,早已过时,了解即可 (过时的日志处理方式)
printStackTrace(PrintStream s)
When debugging locally, using the printStackTrace() method is sufficient.
When the online environment is online, use the logging framework to do it