Many libraries use system properties for settings. For example, you usually have to set a property to enable debug traces or to activate certain behaviors. However, sometimes system properties that are used are not well documented or you are not sure that they are having some effect. In such cases it would be useful to have a way to know which system properties are queried.
There are several manners to do this but I have found a simple way that is not so intrusive. By creating a custom Security Manager you can define a method that checks property accesses. This method is able to send to the logger or to the standard output what property has been queried.
This class should be compiled and available in the classpath.
Now we create in the current directory a file named “java.policy” with the following content:
We just have everything we need to trace calls to System.getProperty. Next we add these parameters to the java call: