Skip to content

Instantly share code, notes, and snippets.

@mikebroberts
Created February 16, 2017 19:11
Show Gist options
  • Save mikebroberts/24d51c46aa8bf0a64bb5d70f65b4953a to your computer and use it in GitHub Desktop.
Save mikebroberts/24d51c46aa8bf0a64bb5d70f65b4953a to your computer and use it in GitHub Desktop.
package io.symphonia;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
public class LoggingLambda {
private static final Logger LOG = LoggerFactory.getLogger(LoggingLambda.class);
public void handler(String s) {
RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
LOG.info("jvm name = [{}]", mxbean.getVmName());
LOG.info("jvm vendor = [{}]", mxbean.getVmVendor());
LOG.info("jvm version = [{}]", mxbean.getVmVersion());
LOG.info("jvm free memory = [{}]", Runtime.getRuntime().freeMemory());
LOG.info("jvm max memory = [{}]", Runtime.getRuntime().maxMemory());
LOG.info("jvm total memory = [{}]", Runtime.getRuntime().totalMemory());
LOG.info("jvm available processors = [{}]", Runtime.getRuntime().availableProcessors());
mxbean.getInputArguments()
.forEach(i -> LOG.info("jvm input argument = [{}]", i));
LOG.info("jvm boot classpath = [{}]", mxbean.getBootClassPath());
LOG.info("jvm classpath = [{}]", mxbean.getClassPath());
mxbean.getSystemProperties()
.forEach((k, v) -> LOG.info("jvm system property = [{} => {}]", k, v));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment