当前位置:网站首页>日志@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;
}
}

边栏推荐
- Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer 论文笔记
- Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama
- Fragment-hide和show
- Real-time data warehouse practice of Baidu user product flow and batch integration
- Basic knowledge of switches
- Codeforces Round #276 (Div. 1) D. Kindergarten
- Merge similar items in LeetCode simple questions
- Drive IT Modernization with Low Code
- Have you guys encountered this problem?MySQL 2.2 and 2.3-SNAPSHOT are like this, it seems to be
- LeetCode中等题之搜索二维矩阵
猜你喜欢

kubernetes介绍

燃炸!字节跳动成功上岸,只因刷爆LeetCode算法面试题

2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。 package main import ( “fmt“ “syn

SenseTime self-developed robotic arm, the first product is an AI chess-playing robot: Guo Jingjing is also invited as an endorsement

生成树协议STP(Spanning Tree Protocol)

bgp dual plane experiment routing strategy to control traffic

接口自动化测试基础篇

把相亲角搬到海外,不愧是咱爸妈

mSystems | Zhongnong Wang Jie Group Reveals the Mechanisms Affecting Soil "Plastic Interstitial" Microbial Communities

Proprietary cloud ABC Stack, the real strength!
随机推荐
山水的高度
CodeForces-834C
Wirshark common operations and tcp three-way handshake process example analysis
LeetCode简单题之合并相似的物品
OTA自动化测试解决方案---整体方案介绍
【目标检测】小脚本:提取训练集图片与标签并更新索引
ABAP 里文件操作涉及到中文字符集的问题和解决方案试读版
C# 当前上下文中不存在InitializeComponent()
作业8.9 构建TCP协议的服务器
MYSQL误删数据恢复
C# WPF image is displayed without problems, but the solution does not display the image at runtime
【iOS】面试整理
Prada, big show?In the yuan in the universe that!
Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama
Fragment-hide和show
AtCoder初学者比赛077 D -小多
C# error The 'xmins' attribute is not supported in this context
LeetCode中等题之搜索二维矩阵
iTextSharp 使用详解
机器学习实战(2)——端到端的机器学习项目