log4j and Tomcat-problem
Hi all,
First I tried to add some logging to my simple Java code with a xml configuration file and it worked fine.
Now I am trying to add logging to the whole java application in the same way which runs in tomcat and face with the foll problem.Tomcat is not able to find the configuration file.I tried to place the xml file in all feasible locations in tomcat and also tried to add in classpath but in vain.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Java Code(Which gets called in startup by another code)
Java Code
public class PublisherPoll implements Runnable {
public static Logger logger = Logger.getLoggerPublisherPoll.class);//***********log4j
public static Logger getLoggerInstance(){//***********log4j
return logger;
}
static{
DOMConfigurator.configure("sudarson.xml");//**********its telling it cant find/open this xml file
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error(during starting tomcat)
log4j:ERROR Could not open [sudarson.xml].
java.io.FileNotFoundException: sudarson.xml (The system cannot find the file sp
cified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.jav
:583)
at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:
87)
at SerenaStartupServlet.init(SerenaStartupServlet.java:44)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper
java:1091)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:9
5)

