X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.osgi.boot%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fboot%2FOsgiBootUtils.java;h=455c96198b3d76f1e8c344608db3b1f08a0a6d54;hb=87b2709a52cae7a2f82f2d8bc8edd82024306bdd;hp=da142cfe9b79c0a7327021e737209c93596f85ff;hpb=ebd927da42511bb5959000c50a39974c6cfa5f49;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBootUtils.java b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBootUtils.java index da142cfe9..455c96198 100644 --- a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBootUtils.java +++ b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBootUtils.java @@ -29,12 +29,16 @@ public class OsgiBootUtils { /** ISO8601 (as per log4j) and difference to UTC */ private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS Z"); + static boolean debug = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_DEBUG) == null ? false + : !System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_DEBUG).trim().equals("false"); + public static void info(Object obj) { System.out.println("# OSGiBOOT # " + dateFormat.format(new Date()) + " # " + obj); } public static void debug(Object obj) { - System.out.println("# OSGiBOOT DBG # " + dateFormat.format(new Date()) + " # " + obj); + if (debug) + System.out.println("# OSGiBOOT DBG # " + dateFormat.format(new Date()) + " # " + obj); } public static void warn(Object obj) { @@ -47,6 +51,9 @@ public class OsgiBootUtils { e.printStackTrace(); } + public static boolean isDebug() { + return debug; + } public static String stateAsString(int state) { switch (state) { @@ -68,7 +75,7 @@ public class OsgiBootUtils { } /** - * @return ==0: versions are identical, <0: tested version is newer, >0: + * @return ==0: versions are identical, <0: tested version is newer, >0: * currentVersion is newer. */ public static int compareVersions(String currentVersion, String testedVersion) {