File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Configure Log4j properties file 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 "Configure Log4j properties file" Watch "Configure Log4j properties file" New topic
Author

Configure Log4j properties file

Prashant Saraf
Ranch Hand

Joined: Sep 25, 2006
Posts: 52

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

Joined: Jun 24, 2003
Posts: 3274
    
    5

How are you now referencing filepath.properties in your code?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Prashant Saraf
Ranch Hand

Joined: Sep 25, 2006
Posts: 52

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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configure Log4j properties file