aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-09-25 22:47:15 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-09-25 22:47:15 +1200
commitc1b6fb0e25020b845b059aef0adebeac7d90ed7c (patch)
treebf52439140ecd372ff2e6a7c0aab634059c6aa46 /src/org/traccar/helper
parente9f466d5169fbbdea0e780a3a7b8221481035ec3 (diff)
downloadtrackermap-server-c1b6fb0e25020b845b059aef0adebeac7d90ed7c.tar.gz
trackermap-server-c1b6fb0e25020b845b059aef0adebeac7d90ed7c.tar.bz2
trackermap-server-c1b6fb0e25020b845b059aef0adebeac7d90ed7c.zip
Small refactoring
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/Log.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java
index d14a7b0bb..a5e9f7594 100644
--- a/src/org/traccar/helper/Log.java
+++ b/src/org/traccar/helper/Log.java
@@ -16,6 +16,10 @@
package org.traccar.helper;
import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
import java.util.Properties;
import org.apache.log4j.Appender;
import org.apache.log4j.DailyRollingFileAppender;
@@ -63,6 +67,29 @@ public class Log {
return logger;
}
+ public static void logSystemInfo() {
+ try {
+ OperatingSystemMXBean operatingSystemBean = ManagementFactory.getOperatingSystemMXBean();
+ Log.info("Operating System" +
+ " name: " + operatingSystemBean.getName() +
+ " version: " + operatingSystemBean.getVersion() +
+ " architecture: " + operatingSystemBean.getArch());
+
+ RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
+ Log.info("Java Runtime" +
+ " name: " + runtimeBean.getVmName() +
+ " vendor: " + runtimeBean.getVmVendor() +
+ " version: " + runtimeBean.getVmVersion());
+
+ MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+ Log.info("Memory Limit" +
+ " heap: " + memoryBean.getHeapMemoryUsage().getMax() / (1024 * 1024) + "mb" +
+ " non-heap: " + memoryBean.getNonHeapMemoryUsage().getMax() / (1024 * 1024) + "mb");
+ } catch (Exception e) {
+ Log.warning("Failed to get system info");
+ }
+ }
+
public static void error(String msg) {
getLogger().error(msg);
}