Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j config file giving FileNotFoundException

 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm new to log4j and trying to configure it from an init method in a servlet, by passing a properties file to PropertyConfigurator.



The web.xml has the file as:



on startng up the server, i'm getting this error:



The properties file is properly written and saved in the location stated in the error message.
Is someone familiar with this problem? please help.
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

1) Make sure that the file really exists.

2) If it exists then, make sure that you got read permission to read the file, as the PropertyConfigurator() will make the FileInputStream to the corresponding file directly.

3) If you have right access then , write a simple jsp page, to find path of the file.

4) Even it does not work, then use ClassLoader directly to load the .property file and call Propertyconfigurator() to read the stystem resource.

double check whether you got .properties file in your classes folder.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this should work if the right file is there in the mentioned location.
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was having way too much trouble with PropertyConfigurator, so I decided to place log4j.properties file in WEB-INF/classes and let Log4j find it and initialize it itself. I'm using Tomcat 5.5 with Eclipse 3.2.

This is the log4j.properties file:



and this is part of the Tomcat log:



What does this mean??? I thought Log4j was supposed to be easy to use
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my app seems to print log statements inspite of those error messages. but i would still love to know what this refer to:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic