/*
 * $Log: LogUtil.java,v $
 * Revision 1.1  2007-02-12 14:10:36  europe\L190409
 * introduction of LogUtil
 *
 */
package nl.nn.adapterframework.util;

import org.apache.log4j.Hierarchy;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.RootCategory;

/**
 * Convenience functions for logging.
 * 
 * @author  Gerrit van Brakel
 * @version Id
 */
public class LogUtil {
	public static final String version="$RCSfile: LogUtil.java,v $  $Revision: 1.1 $ $Date: 2007-02-12 14:10:36 $";

	private static Hierarchy hierarchy = new Hierarchy(new RootCategory(Level.DEBUG));
	
	
	public static Logger getLogger(String name) { 
		return getHierarchy().getLogger(name);
	}

	public static Logger getLogger(Class clazz) { 
		return getLogger(clazz.getName());
	}

	public static Logger getLogger(Object owner) { 
		return getLogger(owner.getClass());
	}


	public static Hierarchy getHierarchy() {
		return hierarchy;
	}

}

@@ -36,17 +36,17 @@
 ision 1.
-1
+2
   2007-0
@@ -51,23 +51,23 @@
 -02-12 1
-4:10:36
+5:56:27
   europe
@@ -75,16 +75,163 @@
 L190409%0A
+ * configure logging hierarchy from log4j.properties%0A *%0A * Revision 1.1  2007/02/12 14:10:36  Gerrit van Brakel %3Cgerrit.van.brakel@ibissource.org%3E%0A
  * intro
@@ -294,16 +294,38 @@
 .util;%0A%0A
+import java.net.URL;%0A%0A
 import o
@@ -414,16 +414,62 @@
 Logger;%0A
+import org.apache.log4j.PropertyConfigurator;%0A
 import o
@@ -699,17 +699,17 @@
 sion: 1.
-1
+2
  $ $Date
@@ -722,23 +722,23 @@
 -02-12 1
-4:10:36
+5:56:27
  $%22;%0A%0A%09p
@@ -774,55 +774,13 @@
 rchy
- = new Hierarchy(new RootCategory(Level.DEBUG))
+=null
 ;%0A%09%0A
@@ -1062,32 +1062,45 @@
 %0A%09public static 
+synchronized 
 Hierarchy getHie
@@ -1110,16 +1110,240 @@
 chy() %7B%0A
+%09%09if (hierarchy==null) %7B%0A%09%09%09hierarchy = new Hierarchy(new RootCategory(Level.DEBUG));%0A%09%09%09URL url = ClassUtils.getResourceURL(LogUtil.class, %22log4j.properties%22);%0A%09%09%09new PropertyConfigurator().doConfigure(url, hierarchy);%0A%09%09%7D%0A
 %09%09return

configure logging hierarchy from log4j.properties