From 753d627296f531b81f65d9180307c44d1f42c00b Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 28 Sep 2005 03:20:33 +0000 Subject: [PATCH] turn on native logging w/ -Dsigar.nativeLogging=true --- bindings/java/src/net/hyperic/sigar/Sigar.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/Sigar.java b/bindings/java/src/net/hyperic/sigar/Sigar.java index 588b064f..b5f8629c 100644 --- a/bindings/java/src/net/hyperic/sigar/Sigar.java +++ b/bindings/java/src/net/hyperic/sigar/Sigar.java @@ -35,6 +35,9 @@ public class Sigar implements SigarProxy { public static final String BUILD_DATE = SigarVersion.BUILD_DATE; + private static boolean enableLogging = + "true".equals(System.getProperty("sigar.nativeLogging")); + private static SigarLoader loader = new SigarLoader(Sigar.class); private FileSystemMap mounts = null; @@ -102,9 +105,16 @@ public class Sigar implements SigarProxy { try { open(); } catch (SigarException e) { - //XXX log? + if (enableLogging) { + e.printStackTrace(); + } } catch (UnsatisfiedLinkError e) { - //XXX log? + if (enableLogging) { + e.printStackTrace(); + } + } + if (enableLogging) { + enableLogging(true); } }