private void log(){
float max=(float)Runtime.getRuntime().maxMemory()/1000000;
float total=(float)Runtime.getRuntime().totalMemory()/1000000;
float free=(float)Runtime.getRuntime().freeMemory()/1000000;
MemoryState logger=new MemoryState();
try {
logger.setServerIP(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
LOG.error("获取服务器地址出错",ex);
LOG.error("Can't get server's internet address", ex, Locale.ENGLISH);
}
logger.setAppName(SystemListener.getContextPath());
logger.setRecordTime(new Date());
logger.setMaxMemory(max);
logger.setTotalMemory(total);
logger.setFreeMemory(free);
logger.setUsableMemory(logger.getMaxMemory()-logger.getTotalMemory()+logger.getFreeMemory());
BufferLogCollector.collect(logger);
}