This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

log4j config file giving FileNotFoundException

 
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.
 
Ranch Hand
Posts: 257
Hibernate Firefox Browser 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.
 
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:

 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!