osgiboot: log date and time
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 6 Nov 2011 21:12:31 +0000 (21:12 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 6 Nov 2011 21:12:31 +0000 (21:12 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@4893 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java

index acc0302e62b2178690052f192946edf36f277da5..fa3ecc2b10ca2dd99951a9573b24c991bd270143 100644 (file)
 \r
 package org.argeo.osgi.boot;\r
 \r
+import java.text.DateFormat;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Date;\r
+\r
 /** Utilities, mostly related to logging. */\r
 public class OsgiBootUtils {\r
+       /** ISO8601 (as per log4j) and difference to UTC */\r
+       private static DateFormat dateFormat = new SimpleDateFormat(\r
+                       "yyyy-MM-dd HH:mm:ss,SSS Z");\r
 \r
        public static void info(Object obj) {\r
-               System.out.println("# OSGiBOOT      # " + obj);\r
+               System.out.println("# OSGiBOOT      # " + dateFormat.format(new Date())\r
+                               + " # " + obj);\r
        }\r
 \r
        public static void debug(Object obj) {\r
-               System.out.println("# OSGiBOOT DBG  # " + obj);\r
+               System.out.println("# OSGiBOOT DBG  # " + dateFormat.format(new Date())\r
+                               + " # " + obj);\r
        }\r
 \r
        public static void warn(Object obj) {\r
-               System.out.println("# OSGiBOOT WARN # " + obj);\r
-               // Because of a weird bug under Windows when starting it in a forked VM\r
-               // if (System.getProperty("os.name").contains("Windows"))\r
-               // System.out.println("# WARN " + obj);\r
-               // else\r
-               // System.err.println("# WARN " + obj);\r
+               System.out.println("# OSGiBOOT WARN # " + dateFormat.format(new Date())\r
+                               + " # " + obj);\r
        }\r
 \r
        /**\r