GeeCON Prague 2014*
The moose likes Other Open Source Projects and the fly likes log4j.properties: FileNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j.properties: FileNotFoundException" Watch "log4j.properties: FileNotFoundException" New topic
Author

log4j.properties: FileNotFoundException

Haritha Gorijavolu
Greenhorn

Joined: Feb 18, 2011
Posts: 21

I am using log4j for logging.I am using a configuration file called log4j.properties. I have placed it in the class path. The program is running fine and events are being printed to the output log.
Yet, when I run the program in eclipse in tomcat server runtime, it is giving the following errors on the console:


Can any one explain why these errors are printed on the console. Thanks in advance.

The following is my log4j.properties file




The following is the code I wrote to use it.


Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
I'm having the same problem, except mine says no appender. even though i have defined and placed the property file in the class path on the unix box. I don't have that property configure line that you have though....I'll try that.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Haritha, if you really have your configuration file in the classpath, then just take out this line:

Not only is it unnecessary, it's the source of the problem as it tells log4j to look in your current working directory for the configuration file. Presumably your current working directory isn't part of your classpath.
Sanjeev P Kulkarni
Greenhorn

Joined: Nov 08, 2009
Posts: 20

Paul Clapham wrote:Haritha, if you really have your configuration file in the classpath, then just take out this line:

Not only is it unnecessary, it's the source of the problem as it tells log4j to look in your current working directory for the configuration file. Presumably your current working directory isn't part of your classpath.


If your log4j.properties file is in the top most of the directory i.e src/log4j.properties then you don't have to use PropertyConfigurator.configure("log4j.properties"); log4j will automatically searches for that file. hope this will help.


Sanjeev
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: log4j.properties: FileNotFoundException