log4j2使⽤properties⽂件进⾏配置
⽹上不少⽂章给的都是⽤xml进⾏配置,也会提到⽆法使⽤properties⽂件对log4j进⾏配置,但那应该只是在他们写⽂章的时候才是如此,最新的2.8.2版本经过我试验后是可以做到的当然该⽂件最好放在特定的⽬录中才⾏,官⽅⽂档也提到了
1.Log4j will inspect the "figurationFile" system property and, if set, will attempt to load the configuration using the ConfigurationFactory that matches the file extension.plc编程用什么笔记本好
2.If no system property is set the YAML ConfigurationFactory will look for log4j2-test.yaml l in the classpath.
3.If no such file is found the JSON ConfigurationFactory will look for log4j2-test.json or log4j2-test.jsn in the classpath.
4.If no such file is found the XML ConfigurationFactory will look l in the classpath.
5.If a test file cannot be located the YAML ConfigurationFactory will look for log4j2.yaml l on the classpath.
6.If a YAML file cannot be located the JSON ConfigurationFactory will look for log4j2.json or log4j2.jsn on the classpath.
7.If a JSON file cannot be located the XML ConfigurationFactory will try to l on the classpath.
哈夫曼树的构造视频讲解8.If no configuration file could be located the DefaultConfiguration will be used. This will cause logging output to go to the console.
name = PropertiesConfig
vb实验教程答案property.filename = target/logs
#appenders = console, file
#配置值是appender的类型,并不是具体appender实例的name
登录界面代码限制登录次数appenders = rolling
rootLogger.level = trace
f = rolling
f = RollingLogFile
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论