当前位置:网站首页>Logback log framework learning and problems
Logback log framework learning and problems
2022-06-13 07:26:00 【Small side good side】
1、 brief introduction
http://logback.qos.ch/, Chinese website http://www.logback.cn/
logback from log4j The founder of Ceki Gülcü Design , As log4j Successor to the framework ,logback Indeed, it is widely used . But from the updated records on the official website , Looks like 2019 Years later, the update speed was obviously slow , I don't know if it's time to go log4j The afterlife of .
Logback from logback core、logback classic and logback access Three modules .logback core It lays the foundation for the other two modules ,logback classic Realized SLF4J API, In this way, our application can switch between other logging frameworks , Such as log4j、java.util.logging (JUL).logback access And servlet Containers ( Such as tomcat or Jetty) Integrate , Provide HTTP To access logs .
2、 Core components
Logback Three core components :Logger、Appender、Layout, The three work together , This allows developers to record messages by message type and level , And control the format of these messages and the location where they are recorded at run time .
3、 To configure
3.1 logback Profile path
The order in which the configuration files are found
(1)classpatch Find... In the path logback-test.xml
(2)classpatch Find... In the path logback.groovy
(3)classpatch Find... In the path logback.xml
(4) Custom profile path , Add... To the startup parameters logback.configurationFile Specify the profile path , Such as :
There are other ways that have not been studied .
3.2 The configuration syntax

4、 Compatibility support
log4j Users can use the PropertiesTranslator take log4j The configuration is converted to logback To configure
5、 problem
5.1 The log file subscript exceeds 1000 Do not delete old files

When the log file subscript exceeds 1000 when , Don't delete files ,totalSizeCap It doesn't work ,bug link :https://jira.qos.ch/browse/LOGBACK-1297
It's still in open state .
terms of settlement , take SizeAndTimeBasedRollingPolicy It is amended as follows FixedWindowRollingPolicy+SizeBasedTriggeringPolicy The way
Single file 10kb, Keep at most 5 File , Make the file subscript always in 1-5 Between , Not more than 1000:
5.2 SizeAndTimeBasedRollingPolicy Method does not precisely control size
Set a single file size 100kb, Total size 1MB when 
It is found that the single file size is far larger than 100kb, Total size also exceeds 1MB
Decompress the log file and find , Single file size 1696KB
But the total size is maintained at 2.12 MB about , There has been no sustained growth
边栏推荐
- How is it that the income of financial products is zero for several consecutive days?
- 全志V3S环境编译开发流程
- [vivefocus uses the wavevr plug-in to obtain handle operation events]
- 基于ESP32CAM实现WebSocket服务器实时点灯
- A. Vacations (dp 贪心
- The biggest highlight of wwdc2022: metalfx
- 6. system call
- RT thread simulator lvgl control: switch switch button control
- 通过函数seaborn.cubehelix_palette生成顺序调色板
- 【硬记】脏读、不可重复读、幻读场景核心区别
猜你喜欢

RT thread simulator lvgl control: slider control

RT thread simulator lvgl control: button button event

The password does not take effect after redis is set

Simple understanding of basic language of C language

RT-Thread 模拟器 simulator LVGL控件:button 按钮样式

C # related knowledge points

Priority analysis of list variables in ansible playbook and how to separate and summarize list variables

First graphical interface

Export chrome plug-ins and import local plug-ins to chrome

RT-Thread 模拟器 simulator LVGL控件:button 按钮事件
随机推荐
An example of CSRF attack defense in web application scenarios
5xx series problem solving
量化框架backtrader之一文读懂Analyzer分析器
汇编语言基础:寄存器和寻址方式
mysql中时间字段 比较时间大小
B. I hate 1111 (mnemonic search number theory
【硬记】脏读、不可重复读、幻读场景核心区别
论文笔记: 多标签学习 BP-MLL
NFV基本概述
Sharp weapon tcpdump
检测循环数“142857“
Functions about Oracle.
通过函数seaborn.cubehelix_palette生成顺序调色板
A solution to the problem that there is always a newline character when C merges multiple RichTextBox contents
Make cer/pfx public and private key certificates and export CFCA application certificates
About database: pgadmin4 editing SQL window
Fundamentals of assembly language: register and addressing mode
Micro isolation (MSG)
Real time lighting of websocket server based on esp32cam
[splashsplash] repeat the script that outputs splashsurf