From df702dfc41e5d03c613d8efbd0c4958de4b549ad Mon Sep 17 00:00:00 2001 From: Romain Manni-Bucau Date: Fri, 6 Jul 2012 01:28:55 +0200 Subject: [PATCH] log4j hack is no more useful for next openejb versions and still work with old ones --- .../java/openejb/OpenEJBObjectFactory.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/openejb/src/main/java/cucumber/runtime/java/openejb/OpenEJBObjectFactory.java b/openejb/src/main/java/cucumber/runtime/java/openejb/OpenEJBObjectFactory.java index 1caa7c5aaf..39e3f41a29 100644 --- a/openejb/src/main/java/cucumber/runtime/java/openejb/OpenEJBObjectFactory.java +++ b/openejb/src/main/java/cucumber/runtime/java/openejb/OpenEJBObjectFactory.java @@ -15,14 +15,6 @@ import java.util.Properties; public class OpenEJBObjectFactory implements ObjectFactory { - static { - try { - configureLog4J(); - } catch (Throwable t) { - throw new CucumberException(t); - } - } - private final List classes = new ArrayList(); private final Map, Object> instances = new HashMap, Object>(); private EJBContainer container; @@ -69,24 +61,5 @@ public T getInstance(Class type) { instances.put(type, object); return object; } - - private static void configureLog4J() throws Throwable { - final ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (System.getProperty("log4j.configuration") == null && System.getProperty("log4j.configurationClass") == null - && cl.getResource("log4j.xml") == null && cl.getResource("log4j.properties") == null) { - Properties log4jProp = new Properties(); - log4jProp.setProperty("log4j.rootLogger", "info, stdout"); - log4jProp.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender"); - try { - cl.loadClass("org.apache.openejb.logging.SimpleJULLikeLayout"); - log4jProp.setProperty("log4j.appender.stdout.layout", "org.apache.openejb.logging.SimpleJULLikeLayout"); - } catch (Exception e) { - log4jProp.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.SimpleLayout"); - } - - Method configure = cl.loadClass("org.apache.log4j.PropertyConfigurator").getDeclaredMethod("configure", Properties.class); - Utils.invoke(null, configure, 0, log4jProp); - } - } }