题目目录
1.项目调试技巧
从四个方面了解:
- 响应状态码的含义
- 服务端断点调试技巧
- 客户端断点调试技巧
- 设置日志级别,并将日志输出到不同的终端
1.1 响应状态码的含义
百度
1.2 服务端断点调试技巧
也就是后端代码;debug时常用的一些快捷键功能:
1.3 客户端断点调试技巧
也就是前端代码
1.4 设置日志级别
五个
级别:trace(等级太低,几乎不用)、debug、info、warn、error
1.4.1 测试日志级别:debug
1.application.properties
#logger--意思是把com.yty.community这个包的日志级别调为 debug
logging.level.com.yty.community=debug;
2.LoggerTests
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = CommunityApplication.class)
public class LoggerTests {
private static final Logger logger = LoggerFactory.getLogger(LoggerTests.class);
@Test
public void testLogger(){
System.out.println(logger.getName());
logger.debug("我是debug log");
logger.info("我是info log");
logger.warn("我是warn log");
logger.error("我是error log");
}
}
3.测试结果
1.4.2 测试日志级别:warn
1.application.properties
#logger--意思是把com.yty.community这个包的日志级别调为 warn
logging.level.com.yty.community=warn;
2.LoggerTests
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = CommunityApplication.class)
public class LoggerTests {
private static final Logger logger = LoggerFactory.getLogger(LoggerTests.class);
@Test
public void testLogger(){
System.out.println(logger.getName());
logger.debug("我是debug log");
logger.info("我是info log");
logger.warn("我是warn log");
logger.error("我是error log");
}
}
3.测试结果
1.4.3 两次日志级别测试说明
定义为什么等级的日志,比它小的级别不会打印出来,大的或等于的级别会打印出来;