当前位置:网站首页>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
边栏推荐
- [splashsplash] repeat the script that outputs splashsurf
- Fundamentals of assembly language: register and addressing mode
- 基于SSM实现水果商城批发平台
- 领先企业的管理实践证明,企业可持续发展的核心是什么?
- 【硬记】脏读、不可重复读、幻读场景核心区别
- TiDB Lightning
- JMeter encryption interface test
- Number of detection cycles "142857“
- P6154 wandering (memory search
- 比较DFS和BFS的优点和缺点及名称词汇
猜你喜欢

How to write an amazing design document?

It's called the next generation monitoring system. Let's see how awesome it is

WWDC2022最大的亮点: MetalFX

通过函数seaborn.cubehelix_palette生成顺序调色板

Oracle problem: the data in the field is separated by commas. Take the data on both sides of the comma

The password does not take effect after redis is set

量化框架backtrader之一文读懂Analyzer分析器

C # related knowledge points

Test development programmers, are you still confused? You can't define yourself as a yard farmer

微隔离(MSG)
随机推荐
redis-5. Redis' RDB, fork, copyonwrite, AOF, RDB & AOF are mixed
RT thread simulator lvgl control: button button style
关于oracle的函数。
快速排序
Relevant knowledge under WinForm
c#高級編程-特性篇
[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution
B. I Hate 1111 (记忆化搜索 数论
对绘制丘岭密度图ridge plot的详细说明、重叠核密度估计曲线overlapping densities、FacetGrid对象、函数sns.kdeplot、函数FacetGrid.map
How idea breaks point debugging
Reflection of C # Foundation
Detailed description of drawing ridge plot, overlapping densities of overlapping kernel density estimation curve, facetgrid object and function sns Kdeplot, function facetgrid map
Ticdc introduction
汇编语言基础:寄存器和寻址方式
redis-2. Redis string type & bitmap
理财产品连续几天收益都是零是怎么回事?
Ticdc synchronization task
What does my financial product mean in clearing?
oracle问题,字段里面的数据被逗号隔开,取逗号两边数据
【硬记】脏读、不可重复读、幻读场景核心区别