• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

log4j config file giving FileNotFoundException

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
reply
    Bookmark Topic Watch Topic
  • New Topic