exception - How to retrieve useful system information in java? -


Which system information is useful - especially when tracing exceptions or other problems - in the Java application?

I am thinking about the information about exceptions, Java / OS information, memory / item consumption, io information, environment / encoding etc.

In addition to the obvious - Exception stack trace - as much information as you can get, all of you Environmental variables should also be found along with system properties. Also, if you have some settings in your app, get all their prices. Of course you should keep all this information in your log file, I used the system. For her simplicity:

  System.out.println ("---- Java System Properties ----"); . System.getProperties () list (System.out); System.out.println ("---- System Environment Variables ----"); Maps & lt; String, string & gt; Env = System.getenv (); Set up & lt; String & gt; Key = env.keySet (); (String key: keys) {System.out.println (key + "=" + env.get (key)); } For most cases this will be "too much" information, but in most cases the stack trace will be enough. Once you find a difficult problem, you will be happy that you have "additional "Notice is 


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -