当前位置:网站首页>Lombok cooperates with @slf4j and logback to realize logging
Lombok cooperates with @slf4j and logback to realize logging
2022-07-03 07:24:00 【Maple Leaf pear flower】
Lombok coordination @Slf4j、Logback Implement logging
Development process , Need to use lombok, But sometimes it is not used SpringBoot frame , Therefore, the log is not automatically imported Jar, Need to be on your own maven Introduction in .
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.6</version>
</dependency>
Introduce the above jar package , And in resources Create below logback.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Can be introduced in the class @Slf4j
test
package com.plf.agent;
import lombok.extern.slf4j.Slf4j;
/**
* @author panlf
* @date 2021/11/10
*/
@Slf4j
public class HelloWorld {
public static void main(String[] args) {
log.info("Hello World");
}
}
// result
//2021-11-10 16:16:09.092 [main] INFO com.plf.agent.HelloWorld - Hello World
边栏推荐
猜你喜欢

Final, override, polymorphism, abstraction, interface

Recursion, Fibonacci sequence

JUC forkjoinpool branch merge framework - work theft

带你全流程,全方位的了解属于测试的软件事故

URL programming

Interfaces and related concepts

Distributed transactions
![[set theory] Stirling subset number (Stirling subset number concept | ball model | Stirling subset number recurrence formula | binary relationship refinement relationship of division)](/img/d8/b4f39d9637c9886a8c81ca125d6944.jpg)
[set theory] Stirling subset number (Stirling subset number concept | ball model | Stirling subset number recurrence formula | binary relationship refinement relationship of division)
![[set theory] partition (partition | partition example | partition and equivalence relationship)](/img/f0/c3c82de52d563f3b81d731ba74e3a2.jpg)
[set theory] partition (partition | partition example | partition and equivalence relationship)

C代码生产YUV420 planar格式文件
随机推荐
Distributed transactions
Selenium key knowledge explanation
10 000 volumes - Guide de l'investisseur en valeur [l'éducation d'un investisseur en valeur]
La différence entre le let Typescript et le Var
Leetcode 213: 打家劫舍 II
C代码生产YUV420 planar格式文件
Longest common prefix and
Docker builds MySQL: the specified path of version 5.7 cannot be mounted.
Discussion on some problems of array
FileInputStream and fileoutputstream
Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
20220319
TypeScript let与var的区别
691. Cube IV
7.2刷题两个
Introduction of transformation flow
"Moss ma not found" solution
Advanced API (serialization & deserialization)
Split small interface
II. D3.js draw a simple figure -- circle