Beyond the obvious - tracing the exception stack - the more information you can get is better. Thus, you should get all the properties of the system, as well as the environment variables. Also, if your application has some settings, get all your values. Of course, you should put all this information in your log file, I used System.out for its simplicity:
System.out.println("----Java System Properties----"); System.getProperties().list(System.out); System.out.println("----System Environment Variables----"); Map<String, String> env = System.getenv(); Set<String> keys = env.keySet(); for (String key : keys) { System.out.println(key + "=" + env.get(key)); }
In most cases, this will be βtoo muchβ information, but for most cases, stack tracing will be sufficient. As soon as you encounter a serious problem, you will be happy that you will have all this "additional" information.
Sergii Pozharov
source share