当前位置:网站首页>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
边栏推荐
- How to quickly batch create text documents?
- 关于局域网如何组建介绍
- Calculate pie chart percentage
- 深入了解3D模型相关知识(建模、材质贴图、UV、法线),置换贴图、凹凸贴图与法线贴图的区别
- [pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return
- Use case labeling mechanism of robot framework
- Database dbvisualizer Pro reported file error, resulting in data connection failure
- 批量制造测试数据的思路,附源码
- Creation of RAID disk array and RAID5
- Use if else to judge in sail software - use the title condition to judge
猜你喜欢
Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale

TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘

Postman batch production body information (realize batch modification of data)

Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption

NVIDIA graphics card driver error

G008-HWY-CC-ESTOR-04 华为 Dorado V6 存储仿真器配置

各大框架都在使用的Unsafe类,到底有多神奇?

Gartner announces emerging technology research: insight into the meta universe

PyTorch:train模式与eval模式的那些坑

英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
随机推荐
各大框架都在使用的Unsafe类,到底有多神奇?
Esxi encapsulated network card driver
Gartner 发布新兴技术研究:深入洞悉元宇宙
Construction of promtail + Loki + grafana log monitoring system
Mock test
Project framework of robot framework
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
Force buckle - 198 raid homes and plunder houses
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
Detailed explanation of gzip and gunzip decompression parameters
Differences between MySQL BTREE index and hash index
【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验
5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
logback的配置文件加载顺序
Camtasia2022软件新增功能介绍
What is homebrew? And use
100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
Real time operation of vim editor
1959年高考数学真题