This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes java logging : java.util.logging.config.file - accessing logging.properties in classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java logging : java.util.logging.config.file - accessing logging.properties in classpath" Watch "java logging : java.util.logging.config.file - accessing logging.properties in classpath" New topic
Author

java logging : java.util.logging.config.file - accessing logging.properties in classpath

Reshma Sadhwani
Greenhorn

Joined: Oct 08, 2009
Posts: 1
Hello,

I have a standalone java application using java logging. I have placed logging.properties in:

com.pkg1.pkg2

I am setting following system property:

-Djava.util.logging.config.file=com/pkg1/pkg2/logging.properties

Unfortunately, the java logging code is not able to locate this file. On debugging into java.util.logging.LogManager.java, it looks like this line of code may be the cause:

InputStream in = new FileInputStream(fname); Here fname = com/pkg1/pkg2/logging.properties and it cannot find the file.

Where should I place logging.properties and how do I set that location in env variable value?

-Djava.util.logging.config.file = WHAT_TO_PUT_HERE?

This app jar is going to run on unix server.

Appreciate your help,thanks.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18708
    
    8

Just put the full absolute path of the properties file. Don't use a relative path unless you are sure you can control the current working directory when the application is run, and if you can then make the path relative to that directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java logging : java.util.logging.config.file - accessing logging.properties in classpath