From: Mathieu Baudier Date: Sun, 6 Nov 2011 21:12:31 +0000 (+0000) Subject: osgiboot: log date and time X-Git-Tag: argeo-commons-2.1.30~1075 X-Git-Url: https://git.argeo.org/?a=commitdiff_plain;h=b799066b80eefac9d6297aff33e95fcdeb1923c3;p=lgpl%2Fargeo-commons.git osgiboot: log date and time git-svn-id: https://svn.argeo.org/commons/trunk@4893 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java index acc0302e6..fa3ecc2b1 100644 --- a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java +++ b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java @@ -16,24 +16,29 @@ package org.argeo.osgi.boot; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + /** Utilities, mostly related to logging. */ 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"); public static void info(Object obj) { - System.out.println("# OSGiBOOT # " + obj); + System.out.println("# OSGiBOOT # " + dateFormat.format(new Date()) + + " # " + obj); } public static void debug(Object obj) { - System.out.println("# OSGiBOOT DBG # " + obj); + System.out.println("# OSGiBOOT DBG # " + dateFormat.format(new Date()) + + " # " + obj); } public static void warn(Object obj) { - System.out.println("# OSGiBOOT WARN # " + obj); - // Because of a weird bug under Windows when starting it in a forked VM - // if (System.getProperty("os.name").contains("Windows")) - // System.out.println("# WARN " + obj); - // else - // System.err.println("# WARN " + obj); + System.out.println("# OSGiBOOT WARN # " + dateFormat.format(new Date()) + + " # " + obj); } /**