This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Java in General and the fly likes log4j config file giving FileNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "log4j config file giving FileNotFoundException" Watch "log4j config file giving FileNotFoundException" New topic

log4j config file giving FileNotFoundException

kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
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.

Who dares, wins! (SAS motto)
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257


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

Joined: Nov 29, 2005
Posts: 2308
I think this should work if the right file is there in the mentioned location.

Rahul Bhattacharjee
LinkedIn - Blog
kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
I was having way too much trouble with PropertyConfigurator, so I decided to place 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 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

Joined: Sep 02, 2000
Posts: 197
my app seems to print log statements inspite of those error messages. but i would still love to know what this refer to:

I agree. Here's the link:
subject: log4j config file giving FileNotFoundException