public class Main { static final Log log = LogFactory.getLog(Main.class); public static void main(String[] args) { log.info("Start process..."); try { "".getBytes("invalidCharsetName"); } catch (UnsupportedEncodingException e) { log.error(e.toString(),e);// TODO: 使用log.error(String, Throwable)打印异常 } log.info("Process end."); } }
Throwable类是Java中所有错误(errors)和异常(exceptions)的父类。
Sign in to make a reply
韬韬蒙塔基
Throwable类是Java中所有错误(errors)和异常(exceptions)的父类。