Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove log4j need for openejb module #355

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> classes = new ArrayList<String>();
private final Map<Class<?>, Object> instances = new HashMap<Class<?>, Object>();
private EJBContainer container;
Expand Down Expand Up @@ -69,24 +61,5 @@ public <T> T getInstance(Class<T> 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);
}
}
}