KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a web app that uses Spring's Log4jConfigurer class to initialize my Log4J log factory. Basically it initializes Log4J with a config file that is off the class path. Here is the config: <bean id="log4jInitializer" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="sbeHome"> <property name="targetClass" value="org.springframework.util.Log4jConfigurer" /> <property name="targetMethod" value="initLogging" /> <property name="arguments"> <list> <value>#{ MyAppHome + '/conf/log4j.xml'}</value> </list> </property> </bean> However I get this error at application startup: log4j:WARN No appenders could be found for logger and tons of Spring application context initialization messages are printed to the console. I think this is because Spring is doing work to initialize my application before it has a chance to initialize my logger. In case it matters, I am using SLF4J on top of Log4J. Is there some way I can get my Log4jConfigurer to be the first bean initialized? or is there some other way to solve this?
Tags (comma-separated)
Save Edits
Cancel