当前位置:网站首页>Log4j output log information to file
Log4j output log information to file
2022-04-23 16:42:00 【A hundred nights】
Log4j It's made up of three important components : Priority of log information , The output destination of log information , The output format of log information . The priority of log information varies from high to low ERROR、WARN、INFO、DEBUG, Used to specify the importance of this log information ; The output destination of the log information specifies whether the log will be printed to the console or to a file ; The output format controls the display of log information .
log4j.properties Output ERROR Level log to console and file .
log4j.rootLogger: Specify log level and output source , Separated by commas .
org.apache.log4j.ConsoleAppender: Specify output to console .
org.apache.log4j.ailyRollingFileAppender: Specify output to file .
log4j.appender.X.File: Specify the output file path .
log4j.appender.X.Append: Specifies that the log data is input into the file in the form of append , The default is false, Designated as true.
log4j.appender.X.Threshold: Specify what log level data to import into the file DEBUG,ERROR.
log4j.appender.X.layout = org.apache.log4j.PatternLayout
log4j.appender.X.layout.ConversionPattern: Specify the presentation form of log data .
### Set up ###
### Set up ###
log4j.rootLogger = debug,D,E
### Output DEBUG Log above level to =E://logs/error.log ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = E://logs/log.log
log4j.appender.D.Append = true
log4j.appender.D.Threshold = DEBUG
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{
yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
### Output ERROR Log above level to =E://logs/error.log ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File =E://logs/error.log
log4j.appender.E.Append = true
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern = %-d{
yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
版权声明
本文为[A hundred nights]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231401521233.html
边栏推荐
- loggie 源码分析 source file 模块主干分析
- Project framework of robot framework
- Oracle data pump usage
- MySQL personal learning summary
- logback的配置文件加载顺序
- Knowledge points and examples of [seven input / output systems]
- 各大框架都在使用的Unsafe类,到底有多神奇?
- Mock test using postman
- Use if else to judge in sail software - use the title condition to judge
- Sail soft calls the method of dynamic parameter transfer and sets parameters in the title
猜你喜欢
Modify the test case name generated by DDT
Gartner 发布新兴技术研究:深入洞悉元宇宙
Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale
LVM与磁盘配额
Construction of promtail + Loki + grafana log monitoring system
PyTorch:train模式与eval模式的那些坑
Knowledge points and examples of [seven input / output systems]
Real time operation of vim editor
Nacos 详解,有点东西
NVIDIA显卡驱动报错
随机推荐
Set cell filling and ranking method according to the size of the value in the soft report
Pytorch: the pit between train mode and eval mode
MySQL的btree索引和hash索引区别
Calculate pie chart percentage
建站常用软件PhpStudy V8.1图文安装教程(Windows版)超详细
PHP 零基础入门笔记(13):数组相关函数
Nacos detailed explanation, something
Gartner announces emerging technology research: insight into the meta universe
Derivation of Σ GL perspective projection matrix
Use case execution of robot framework
logback的配置文件加载顺序
Esxi encapsulated network card driver
What is homebrew? And use
Introduction to new functions of camtasia2022 software
计组 | 【七 输入/输出系统】知识点与例题
∑GL-透视投影矩阵的推导
JIRA screenshot
Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption
JMeter setting environment variable supports direct startup by entering JMeter in any terminal directory
Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand