当前位置:网站首页>日志@Slf4j介绍使用及配置等级
日志@Slf4j介绍使用及配置等级
2022-08-10 12:52:00 【李长渊哦】
一、依赖及插件
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
安装一个lombok插件
二、设置日志级别
日志级别从小到大为 trace < debug < info < warn < error < fatal,由于默认日志级别设置为 INFO,因此info级别的日志时, trace 和 debug 级别的日志都看不到。
我们可以在 applicaition.yml文件中修改日志级别。比如将全局日志级别都改成 trace,则系统所有的日志都能看到
logging:
level:
com.example.demo: trace #com.example.demo为包名
三、演示
@Slf4j
@RestController
public class LogController {
@ApiOperation("测试日志")
@GetMapping("/LogTest")
public People queryList() {
People people = new People(1, "小王", 1);
log.error(people.toString());
log.warn(people.toString());
log.info(people.toString());
//比如将全局日志级别都改成 trace,则系统所有的日志都能看到。
log.debug(people.toString());
log.trace(people.toString());
return people;
}
}
边栏推荐
- Codeforces Round #276 (Div. 1) D. Kindergarten
- 鸿蒙开发从hello world开始
- 【iOS】Organization of interviews
- Loudi Sewage Treatment Plant Laboratory Construction Management
- Redis 定长队列的探索和实践
- Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
- 来看Prada大秀吗?在元宇宙里那种!
- OTA自动化测试解决方案---整体方案介绍
- Merge similar items in LeetCode simple questions
- ArcMAP has a problem of -15 and cannot be accessed [Provide your license server administrator with the following information:Err-15]
猜你喜欢
Wirshark common operations and tcp three-way handshake process example analysis
把相亲角搬到海外,不愧是咱爸妈
Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
ABAP file operations involved in the Chinese character set of problems and solutions for trying to read
ArcMAP出现-15的问题无法访问[Provide your license server administrator with the following information:Err-15]
Proprietary cloud ABC Stack, the real strength!
Ethernet channel Ethernet channel
ABAP 里文件操作涉及到中文字符集的问题和解决方案试读版
神经网络可视化有3D版本了,美到沦陷!(已开源)
[Study Notes] Persistence of Redis
随机推荐
rpn:def concat_box_prediction_layers
Shell:数组
【mysql索引实现原理】
11+ chrome高级调试技巧,学会效率直接提升666%
2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。 package main import ( “fmt“ “syn
R语言实战应用案例:论文篇(一)-特殊柱形图绘制
Fragment-hide和show
shell:常用小工具(sort、uniq、tr、cut)
Solution for "Certificate not valid for requested usage" after Digicert EV certificate signing
进程和计划任务管理
OTA自动化测试解决方案---整体方案介绍
Codeforces Round #276 (Div. 1) B. Maximum Value
Inventory of Loudi Agricultural Products Inspection Laboratory Construction Guidelines
没有接班人,格力只剩“明珠精选”
mSystems | Zhongnong Wang Jie Group Reveals the Mechanisms Affecting Soil "Plastic Interstitial" Microbial Communities
【jstack、jps命令使用】排查死锁
Loudi Sewage Treatment Plant Laboratory Construction Management
【黑马早报】雷军称低谷期曾想转行开酒吧;拜登正式签署芯片法案;软银二季度巨亏230亿美元;北京市消协约谈每日优鲜...
Merge similar items in LeetCode simple questions
C#WPF 图片在显示时没有问题,但在运行时图片显示不出来的解决