try{
int i =1/0;
}catch(Exception e){
logger.error(e+" || "+new SimpleDateFormat("yyyy-mm-dd HH:mm:ss").format(System.currentTimeMillis()));
logger.error(e.getCause());
logger.error(e.getLocalizedMessage());
logger.error(e.getMessage());
logger.error(e.getClass());
}
输出结果:
ERROR - java.lang.ArithmeticException: / by zero || 2015-29-11 14:29:36
ERROR - null
ERROR - / by zero
ERROR - / by zero
ERROR - class java.lang.ArithmeticException