提示Use a logger to log this exception.
try {
//业务代码
} catch (Exception e) {
e.printStackTrace();//提示Use a logger to log this exception.
}
解决:定义一个日志工具类
public class LogerUtil {
private static Logger logger = Logger.getLogger(LogerUtil.class);
/**
* 记录日志:
*
* @param clazz
* 所在类名
* @param str
* 哪里异常
* @param e
* 什么异常
*/
public static void log(Class<?> clazz, String str, Exception e) {
logger.info(clazz.getSimpleName() + ": " + str + ", " + e);
}
}
代码改成
try {
//业务代码
} catch (Exception e) {
LogerUtil.log(XXX.class, "哪里有错", e);
}