• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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: 28003
94
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.
 
This tiny ad is wafer thin:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic