-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kumaravel,
On 12/16/2009 4:39 AM, jkv wrote: > I am using tomcat 6.0 and created a log4j configuration folder under > WEB-INF/classes/log4j.properties. I have my log4j.jar file in WEB-INF/lib > folder. I created a simple servlet where in the init method I have the > following line > > PropertyConfigurator.configure("log4j.properties"); This method takes a filename. Since you've not provided a path to the file, here, where did you put your file to ensure that it gets properly loaded? > but this is throwing FileNotFoundException?? Should my properties file be in > my class path? That depends on how you configure log4j. We simply do this: new PropertyConfigurator(); ...and put log4j.properties into the CLASSPATH by dropping it into the WEB-INF/classes directory in our webapp. > Also I created a test setup by creating a sample test.txt > file under WEB-INF/classes folder. When I open the file in my servlet I get > the same FNF Exception?? What path are you using when you try to open the file? If you aren't fully-specifying the path, then the path is relative. Relative to what? Relative to the current working directory of the JVM process. What's the CWD? It could be anything, though it tends to be either the CWD of the parent process or CATALINA_BASE. You shouldn't have to worry about that, though, because you should always fully-specify your file paths. Better yet, load your file using the ClassLoader. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksqomkACgkQ9CaO5/Lv0PA7MQCgsLVY4bVhSW3ijmaTemfTb5OK 9m4An1gOgbdkFI7OYHqmRCMIXA/Zw2nI =eLMQ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org