我有一个想要登录的 maven 和 spring 应用程序。我热衷于使用 SLF4J。
我想将所有配置文件放入目录 {classpath}/config 中,包括 log4j.xml,然后使用 spring bean 进行初始化。
例如
<bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.util.Log4jConfigurer"/>
<property name="targetMethod" value="initLogging"/>
<property name="arguments">
<list>
<value>classpath:config/log4j.xml</value>
</list>
</property>
</bean>
但是我收到此警告并且没有记录。
log4j:WARN 找不到记录器的附加程序(org.springframework.context.support.ClassPathXmlApplicationContext)。log4j:WARN 请正确初始化 log4j 系统。log4j:WARN 有关详细信息,请参阅http://logging.apache.org/log4j/1.2/faq.html#noconfig。
我用谷歌搜索,找不到一个简单的例子来设置它。有任何想法吗?