This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes java.util.logging.LogManager.getProperty(String nameStr) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "java.util.logging.LogManager.getProperty(String nameStr)" Watch "java.util.logging.LogManager.getProperty(String nameStr)" New topic
Author

java.util.logging.LogManager.getProperty(String nameStr)

Robert Emmons
Greenhorn

Joined: Jun 07, 2005
Posts: 7
java.util.logging.LogManager.getProperty(String nameStr) returns the value of the nameStr property, but how do I get a list of the names of the properties?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32839
    
    4
Don't know, but this sounds a more difficult question that we usually get here in beginners'.
Moving
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1431

Barring the use of reflection to access the private Properties field (called "props"), there doesn't appear to be any way to programatically retrieve an enumeration of configured properties. However, the LogManager API documentation does provide some details about the names of some of the system and global properties, and also some naming conventions. It also refers to the default configuration file ( called "logging.properties"), which can be located in the "lib" directory of the JRE. You could take a look at that file to see what the default configuration should look like.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Robert Emmons
Greenhorn

Joined: Jun 07, 2005
Posts: 7
Thanks for the info.

I did review the API, and saw no method that returned the Enumeration I wanted.

I understand that the properties are generally set by the LogManager reading a logging.properties file, but the file is not always located in JRE/lib. As I understand it, the file location can be changed in an argument starting the VM. It can also be changed by program code. In addition, after the file is loaded, properties can be added or changed by code. Also, I am working with servlets on a Tomcat server, and I believe Tomcat searches a classpath for the file, using the first one it finds in the path, not necessarily the one you may have intended.

With all that going on, I was hoping to find some way to get a definite list of properties, and there values, but I guess it is not too easy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.util.logging.LogManager.getProperty(String nameStr)
 
Similar Threads
candidates
EOF Exception while reading Data Section
hibernate
Using volatile
Selecting data from multiple tables