slf4j整合tinylog
- 导入相关的依赖
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29<!-- tinylog.version = 2.7.0 -->
<!-- lombok.version = 1.8.36 -->
<dependencies>
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>tinylog-api</artifactId>
<version>${tinylog.version}</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>tinylog-impl</artifactId>
<version>${tinylog.version}</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>slf4j-tinylog</artifactId>
<version>${tinylog.version}</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>log4j1.2-api</artifactId>
<version>${tinylog.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies> - 配置tinylog.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19# 全局等级
level@org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener=error
level@org.springframework.beans.factory.support.DefaultSingletonBeanRegistry]=error
level@org.springframework.data.convert.CustomConversions=error
level@org.springframework.beans.factory.support.DefaultSingletonBeanRegistry=error
level@org.springframework.beans.factory.support.ConstructorResolver=error
level@org.springframework.core.env.PropertySourcesPropertyResolver=error
level@io.netty.util.internal=error
# 控制台输出
writer_console=console
writer_console.level=debug
writer_console.format=[{date: HH:mm:ss.SSS}] [{level}] [{thread}] [{class}] ==> {message}
# 文件输出
writer_file=file
writer_file.level=debug
writer_file.file=tinylog.log
writer_file.format=[{date: yyyy-MM-dd HH:mm:ss.SSS}] [{level}] [{thread}] [{class}] ==> {message}
writer_file.charset=UTF-8
writer_file.append=true