Thanks Charles for the reply.., I got the answer myself after a long time... Actually its like this
IF you have a default log file for log4j configuration that is "log4j.configuration" under WEB-INF/classes folder and did not use this statement PropertyConfigurator.configure("log4j.properties"); then the system works fine, I dont know how but log4j is intelligent to pick the file "log4j.properties" from the classes folder. But the problem starts only if you try to configure using a PropertyConfigurator having the same file there and use the above statement then you get FNFExe because the classpath is acutally bin folder of Tomcat and log4j searches the bin folder for a log4j.configuration which is actually strange. So you will have to use this statement PropertyConfigurator.configure(servletContext.getRealPath("/") + "/WEB-INF/classes/" + "log4j.properties"); The similar is the case for any file in Tomcat, ie is if you want to read from a custom file in tomcat say your own configurations for web application the you will have to use the Path for the file using the servletContest.getRealPath("/") + ... your expected file path starting from root. Thanks for your valuable time Regards JKV Caldarale, Charles R wrote: > >> From: jkv [mailto:j.kumara...@gmail.com] >> Subject: FileNotFoundException in Tomcat6.0 >> >> I created a simple servlet where in the init method I have the >> following line >> >> PropertyConfigurator.configure("log4j.properties"); >> >> but this is throwing FileNotFoundException?? > > Let's see the stack trace. Does the Tomcat userid have access to the > file? > >> Should my properties file be in my class path?? > > Never, never, never use the CLASSPATH environment variable, especially > with Tomcat. The Tomcat startup scripts set the -cp parameter properly; > don't muck with it. > > - Chuck > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you > received this in error, please contact the sender and delete the e-mail > and its attachments from all computers. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > -- View this message in context: http://old.nabble.com/FileNotFoundException-in-Tomcat6.0-tp26808548p26827295.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org