package com.xoba.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class LogFactory {

	public synchronized static ILogFactory getDefault() {

		if (SINGLETON == null) {
			SINGLETON = new DefaultLogFactory();
		}

		return SINGLETON;

	}

	private static ILogFactory SINGLETON;

	static final class MyLogger implements ILogger {

		private final DateFormat df = new SimpleDateFormat(
				"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
		private final String name;

		public MyLogger(String name) {
			this.name = name;
			df.setTimeZone(TimeZone.getTimeZone("GMT"));
		}

		public void debugf(String fmt, Object... args) {
			core("DEBUG", fmt, null, args);
		}

		public synchronized void core(String type, String fmt, Throwable t,
				Object... args) {
			System.out.printf("%5s %s %s: ", type, df.format(new Date()), name);
			if (args == null) {
				System.out.print(fmt);
			} else {
				System.out.printf(fmt, args);
			}
			System.out.println();
			if (t != null) {
				t.printStackTrace(System.out);
			}
		}

		public void warn(String fmt, Throwable t, Object... args) {
			core("WARN", fmt, t, args);

		}

		public void warnf(String fmt, Object... args) {
			core("WARN", fmt, null, args);
		}

		public void errorf(String fmt, Object... args) {
			core("ERROR", fmt, null, args);
		}
	}

}
@@ -17,16 +17,44 @@
 .util;%0A%0A
+import java.io.IOException;%0A
 import j
@@ -132,16 +132,44 @@
 l.Date;%0A
+import java.util.Formatter;%0A
 import j
@@ -512,21 +512,16 @@
 eFormat(
-%0A%09%09%09%09
 %22yyyy-MM
@@ -842,21 +842,17 @@
 wable t,
-%0A%09%09%09%09
+ 
 Object..
@@ -861,36 +861,79 @@
 args) %7B%0A
+%0A
 %09%09%09
-System.out.printf
+Formatter formatter = new Formatter();%0A%0A%09%09%09formatter.format
 (%22%255s %25s
@@ -976,16 +976,17 @@
  name);%0A
+%0A
 %09%09%09if (a
@@ -1004,32 +1004,49 @@
 ) %7B%0A%09%09%09%09
-System
+try %7B%0A%09%09%09%09%09formatter
 .out
-.print
+().append
 (fmt);%0A%09
@@ -1051,38 +1051,73 @@
 %0A%09%09%09
-%7D else %7B%0A%09%09%09%09System.out.printf
+%09%7D catch (IOException e) %7B%0A%09%09%09%09%7D%0A%09%09%09%7D else %7B%0A%09%09%09%09formatter.format
 (fmt
@@ -1130,16 +1130,17 @@
 );%0A%09%09%09%7D%0A
+%0A
 %09%09%09Syste
@@ -1153,19 +1153,29 @@
 println(
+formatter
 );%0A
+%0A
 %09%09%09if (t

use one call to System.out.println, not many, since the latter confuses jboss' STDOUT