Github user apiri commented on a diff in the pull request: https://github.com/apache/nifi/pull/218#discussion_r55791913 --- Diff: nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java --- @@ -546,6 +552,31 @@ public void status() throws IOException { } } + public void env(){ + final Logger logger = cmdLogger; + final Status status = getStatus(logger); + if(status.getPid() == null){ + logger.info("Apache NiFi is not running"); + return; + } + try{ + final Class<?> virtualMachineClass=Class.forName("com.sun.tools.attach.VirtualMachine"); + Method attachMethod=virtualMachineClass.getMethod("attach", String.class); + Object virtualMachine=attachMethod.invoke(null, status.getPid()); + Method getSystemPropertiesMethod=virtualMachine.getClass().getMethod("getSystemProperties"); + final Properties sysProps=(Properties)getSystemPropertiesMethod.invoke(virtualMachine); + for(Entry<Object, Object> syspropEntry: sysProps.entrySet()){ + logger.info(syspropEntry.getKey().toString() + " = " +syspropEntry.getValue().toString()); + } + Method detachMethod=virtualMachineClass.getDeclaredMethod("detach"); + detachMethod.invoke(virtualMachine); + }catch(ClassNotFoundException cnfe){ + logger.error("Seems tools.jar(Linux / Windows JDK) or classes.jar(Mac OS) is not available in classpath", cnfe); + }catch(Throwable t){ + throw new RuntimeException(t); --- End diff -- Not sure the stacktrace provides much information worthwhile to the user. Would opt to just leave the above log error and remove this.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---