Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j.properties: FileNotFoundException

 
Haritha Gorijavolu
Greenhorn
Posts: 21
Debian Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21152
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
Eclipse IDE Google Web Toolkit Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic