当前位置:网站首页>Description of rollingfileappender attribute in logback
Description of rollingfileappender attribute in logback
2022-07-29 07:24:00 【qq_ twenty-five million seventy-three thousand two hundred and 】
from :
logback in RollingFileAppender Description of property introduction
The following is about logback in RollingFileAppender Property setting method sharing , As shown below :
logback in RollingFileAppender For scrolling record files First log to the specified file When a condition is met , Log to other files
RollingFileAppender attribute
<file>: The name of the file being written , It can be a relative Directory , It can also be an absolute catalog If the parent directory does not exist, it will be created automatically , No default <append>: When set to true, The log is appended to the end of the file When set to false, Empty existing files , The default is true <rollingPolicy>: When rolling happens , decision RollingFileAppender act , It involves moving and renaming files attribute class Define specific rolling strategy classes ,"ch.qos.logback.core.rolling.TimeBasedRollingPolicy" Is the most commonly used scrolling strategy It makes rolling strategies based on time , Responsible for rolling as well as starting rolling . <fileNamePattern>: Necessary nodes , Contains the file name and “%d” Conversion character ,“%d” It can contain a java.text.SimpleDateFormat Specified time format , Such as :%d{yyyy-MM} When used directly %d, The default format is yyyy-MM-dd RollingFileAppender Of file Byte points are optional , By setting file You can specify different locations for active and archived files , The current log always records file Specified file ( Activity file ) The name of the active file will not change If not file, The name of the activity file will be based on fileNamePattern Value Change every once in a while “/” perhaps “\” Will be used as a directory separator <maxHistory>: Optional nodes , Control the maximum number of archive files that are retained , Delete old files if the number exceeds Suppose you set the scroll every month , And <maxHistory> yes 6, Save only recent 6 Months of documents , Delete old files before Be careful , Deleting old files is , Directories created for archiving will also be deleted ."ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy" Is to view the size of the currently active file , If it exceeds the specified size, it will inform RollingFileAppender Triggers the scrolling of the currently active file . Only one node : <maxFileSize>: This is the size of the active file , The default value is 10MB. <prudent>: When it comes to true when , I won't support it FixedWindowRollingPolicy Support TimeBasedRollingPolicy, But there are two limitations ,1 File compression is not supported or allowed ,2 Cannot set file attribute , Must be left blank . <triggeringPolicy >: inform RollingFileAppender Appropriate to activate scrolling ."ch.qos.logback.core.rolling.FixedWindowRollingPolicy" According to the fixed window algorithm rename the file rolling strategy . <minIndex>: Minimum window index <maxIndex>: Maximum window index , When the window specified by the user is too large , Will automatically set the window to 12. <fileNamePattern>: Must contain “%i” for example , Suppose that the minimum and maximum values are respectively 1 and 2, The naming pattern is mylog%i.log, There will be an archive mylog1.log and mylog2.log. You can also specify file compression options , for example ,mylog%i.log.gz Or not log%i.log.zip <encoder>: Format the recorded events . Responsible for two things , One is to convert log information into byte array The second is to write the byte array to the output stream PatternLayoutEncoder Is the only useful and default encoder There is one <pattern> node , Used to set the input format of the log Use “%” Add “ Conversion character ” The way , If you want to output “%”, You have to use “\” Yes “\%” Transference
example
// Generate a log file every day , preservation 20 Days of log files <configuration> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>20</maxHistory> </rollingPolicy> <encoder> <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> </encoder> </appender> <root level="DEBUG"> <appender-ref ref="FILE" /> </root> </configuration>
边栏推荐
- gin 参数验证
- Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
- gcc/g++的使用
- JS chicken laying eggs and egg laying chickens. Who appeared earlier, object or function? Is function an instance of function?
- 个人博客系统(附源码)
- 我想问一下,我flink作业是以upsert-kafka的方式写入数据的,但是我在mysql里面去更
- gin 服务退出
- MySQL 使用客户端以及SELECT 方式查看 BLOB 类型字段内容总结
- logback filter过滤器简介说明
- Paper reading (62):pointer networks
猜你喜欢
3-全局异常处理
Interface test actual project 03: execute test cases
JS break and continue and return keywords
js中break与continue和return关键字
以太网接口介绍
MySQL - multi table query
Scala higher order (10): exception handling in Scala
H3C_ Using setting default static routing priority to realize the active and standby function of export dual lines
leetcode力扣经典问题——4.寻找两个正序数组的中位数
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
随机推荐
Homebrew brew update doesn't respond for a long time (or stuck in updating homebrew...)
Cvpr2021 | multi view stereo matching based on self supervised learning (cvpr2021)
Leetcode 209. subarray with the smallest length (2022.07.28)
Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)
Vue router route cache
Excel文件读写(创建与解析)
Round avatar of user list and follow small blocks
后缀自动机(SAM)讲解 + Luogu p3804【模板】后缀自动机 (SAM)
MySQL 有这一篇就够(呕心狂敲37k字,只为博君一点赞!!!)
When NPM is installed, it is stuck. There are five solutions
使用VsCode配置MySQL实现连接、查询、等功能
MySQL如何把行转换为列?
Nodejs installation tutorial
log4j Layout简介说明
logback中RollingFileAppender属性简介说明
OCR光学字符识别方法汇总
logback简介及引入方法
NPM install reports an error NPM err could not resolve dependency NPM err peer
0 9 布隆过滤器(Bloom Filter)
H3C_利用设置缺省静态路由优先级实现出口双线路的主备功能