• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

log4j.properties: FileNotFoundException

 
Greenhorn
Posts: 21
Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 20
Google Web Toolkit Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Always look on the bright side of life. At least this ad is really tiny:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic