StringBuffer sb = new StringBuffer();
sb.append("Environment vars: ---------------------------------------\n");
Properties props = System.getProperties();
if(props != null && props.size() > 0) {
Enumeration enum = props.keys();
String key = null;
while(enum.hasMoreElements()) {
key = (String)enum.nextElement();
sb.append(key + ": " + props.getProperty(key) + "\n");
}
}
sb.append("\nEnvironment vars: ---------------------------------------\n");
//System.out.println(sb.toString());
logger.info(sb.toString());
Tech notes and other thoughts that I can access easily. Only publicly viewable information will be posted. Everything here are solely my opinions and for educational purposes only. You are solely responsible for the usage of any information you've found here.
Monday, March 12, 2007
Dumping environment variables
If you ever wanted to know what your "accessible" environment variables are at run time, put the code snippet below anywhere within your code execution path and print either to your log or System.out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment