aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Log.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/helper/Log.java')
-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);
}