当前位置:网站首页>Introduction and introduction of logback
Introduction and introduction of logback
2022-07-29 07:25:00 【qq_ twenty-five million seventy-three thousand two hundred and 】
from :
logback Introduction to relevant tutorials
The author will talk about it below logback Related introduction and description of the log component , As shown below :
logback brief introduction
logback Is an open source logging component It is from log4j Designed by the author of , Have better features , Used in place of log4j A log framework for
logback Module
logback-core: yes logback-access,logback-classic The foundation of the two modules logback-classic: It is log4j An improved version of , At the same time, it completely realizes slf4j API, So that we can log in other systems , Such as log4j and JDK14 Logging Conversion in logback-access: Access modules and Servlet Container Integration , by tomcat And so on Http To access the function of the log
logback Main classes
Logger:logback-classic Module , As a log recorder , Relate it to the application's corresponding context after , It is mainly used to store log objects , You can also define the log type 、 Level . Same as log4j logger Function the same Appender: be located logback-core in , It is mainly used to specify the destination of log output , The destination can be the console 、 file 、 Remote socket server 、MySQL、PostreSQL、Oracle And other databases 、JMS And remote UNIX Syslog Daemons, etc . Layout: be located logback-core in , Responsible for converting events to strings , Format the output of log information , For details, see log4j Of layout Detailed explanation Appender and Layout Not care Logger The existence of , Don't depend on Logger, At the same time, we can see ,Logger Will depend on Appender and Layout With the help of , Log information can be printed normally filter:Filter Mainly used in appeder On , Only in appender Level works , Play a role in filtering logs .
The level of logging
logback Yes 5 Class
TRACE < DEBUG < INFO < WARN < ERROR, Defined in ch.qos.logback.classic.Level Class .
The configuration file
logback You can use logback.xml To configure logback Configure the reading steps : 1. Try to classpath Look for the file logback-test.xml 2. When the file doesn't exist , Find the file logback.xml 3. When both files do not exist , Then use BasicConfigurator Automatically configure yourself , Output the record to the console
maven rely on
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.21</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.1.7</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.7</version> </dependency>
边栏推荐
猜你喜欢

Kubernetes (V) -- deploy kubernetes dashboard

1-后台项目搭建

Redis基础篇

2-unified return class dto object

MySQL如何把行转换为列?

Why does ETL often become ELT or even let?

How does MySQL convert rows to columns?

在线问题反馈模块实战(十七):实现excel模板在线下载功能

Summary of OCR optical character recognition methods

Using C language to skillfully realize the chess game -- Sanzi chess
随机推荐
Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
[redis] redis development specifications and precautions
Scala higher order (IX): pattern matching in Scala
1-后台项目搭建
Variables and encryption in ansible
leetcode力扣经典问题——4.寻找两个正序数组的中位数
cdc source能读完MySqlSnapshotSplit 就退出嘛
Why does ETL often become ELT or even let?
Zabbix 其他基础监控项
对Vintage分析的一些学习理解
CVPR2021| 基于自监督学习的多视图立体匹配 (CVPR2021)
Fillder use
Use vscode to configure Mysql to realize connection, query, and other functions
[100 cases of unity practice] the single choice multiple choice judgment questions of unity universal question answering system are all common
【OpenGL】着色器(Shader)的使用
Gin Middleware
如何与斯堪尼亚SCANIA建立EDI连接?
Vite3.0 has been released, can you still roll it (list of new features)
How to use GS_ Expansion expansion node
Operator3-设计一个operator