使用slf4j读取.properties文件 [英] read .properties file using slf4j
问题描述
我想使用slf4j从.properties文件中读取数据,我可以在控制台上输出数据,但我想要的是在某个文件上输出数据,所以我需要文件Appender,这是在.properties中声明的文件,我无法使用slf4j读取.properties文件。任何人都可以帮忙。
PS:我需要一个例子来解释如何在slf4j中使用.properties文件以及如何为此初始化记录器工厂。
请参阅 http ://slf4j.org/faq.html 。
SLF4J只是一个外观,意味着它不提供完成
日志记录解决方案。使用SLF4J无法执行配置appender或设置
日志记录级别等操作。
slf4j-simple不提供额外的功能配置功能。</ p>
对于其他实现,您应该使用它们提供的配置方式。
例如,slf4j-log4j的log4j.properties。请参阅 http://logging.apache.org/log4j/1.2/manual.html#配置。
I want to read data from .properties file using slf4j,T i am able to output the data on console but what i want is to output the data on some file so i need file Appender for this which is declared in .properties file and i am not able to read the .properties file using slf4j.Can anyone help.
PS:I need an example that explains how to use.properties file in slf4j and how to initialize logger factory for that.
See http://slf4j.org/faq.html.
SLF4J is only a facade, meaning that it does not provide a complete logging solution. Operations such as configuring appenders or setting logging levels cannot be performed with SLF4J.
slf4j-simple doesn't provide extra configuration features at all.
For other implementations you should use the way to configure they provide.
For example, log4j.properties for slf4j-log4j. See http://logging.apache.org/log4j/1.2/manual.html#Configuration.
这篇关于使用slf4j读取.properties文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!