• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Configure Log4j properties file

 
Prashant Saraf
Ranch Hand
Posts: 57
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using PropertyConfigurator.configure("c://filepath.properties"). Now my application is going to use to several other server, i want to make this file accessible from anywhere, so i put this file in same package where my LoggingUtility Class is, but it not accessing the files. I always get File not found Exception.
can someone help me into this.

Thanks
Prashant Saraf
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you now referencing filepath.properties in your code?
 
Prashant Saraf
Ranch Hand
Posts: 57
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:How are you now referencing filepath.properties in your code?


I am referencing it with hard coded path :



 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK,well that is not going to work because you are not putting that file at that location on every server correct? Instead you want to read that resource off the CLASSPATH (as you have now put the properties file in the same location as your .class file).

To do that in Java you need to look at using the getResourceAsStream() method....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic