日志对查找问题,非常重要!
1、通常使用什么日志组件
logback
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
2、什么情况下添加日志呢?
- 必要的调用流程,用info来提示流程
- 出现报错信息,用error来打印堆栈信息。注意:一定要打印堆栈信息
详情:http://codepub.cn/2016/04/15/Log4j-print-exception-stack-information-to-the-log/
日志对查找问题,非常重要!
logback
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
详情:http://codepub.cn/2016/04/15/Log4j-print-exception-stack-information-to-the-log/