• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Robert Emmons
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, but this sounds a more difficult question that we usually get here in beginners'.
Moving
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Robert Emmons
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!