A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Other Application Frameworks
log4j configuration in Sping
Joined: Jun 10, 2004
Nov 23, 2008 23:36:00
6 running with jdk1.6 using Spring 2.5 & Eclipse 3.4 IDE
<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>config/log4j.xml</value> </list> </property> </bean> </beans>
The problem is when applicationContext.xml is loaded, following error is generarted
INFO: Initializing Spring root WebApplicationContext log4j:ERROR Could not open [file:/C:/Program%20Files/Apache%20Software%20Foundation/Apache%20Tomcat%206.0.16/config/log4j.xml]. java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.16\config\log4j.xml (The system cannot find the path specified)
It tries to search file inside <tomcathome>/config/log4j.xml
Whereas what needed is locating file at <context root>/config/log4j.xml
Definitely, it�s one some setting which needs to be altered.
But how & where is my question.
Joined: Feb 05, 2001
Nov 24, 2008 11:11:00
You can always prefix resource with either "classpath:" or "file:" or "http:"
Classpath looks for the file in the classpath.
File looks in the OS
Http looks in your web environment.
Sometimes too, you need to just put a "/" in front of your path. But I doubt that that would work for you.
Perfect World Programming, LLC
Two Laptop Bag
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: log4j configuration in Sping
Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transactio
Problem regarding Struts+Spring+hibernate
Spring2.5.6+Tomcat7: HTTP Status 404: The requested resource () is not available
Unit tetsing (Junit) Spring Framework
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014