Author: echatellier Date: 2011-05-05 18:36:35 +0200 (Thu, 05 May 2011) New Revision: 3100 Url: http://chorem.org/repositories/revision/lima/3100 Log: Pesudo hack pour surcharger les options de logging par defaut de openejb Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2011-05-05 13:56:23 UTC (rev 3099) +++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2011-05-05 16:36:35 UTC (rev 3100) @@ -25,13 +25,18 @@ package org.chorem.lima.service; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; +import java.util.HashMap; import java.util.Properties; -import java.util.HashMap; + import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; + +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.openejb.OpenEJB; @@ -63,6 +68,23 @@ // TODO EC-20100407 maybe put all options in LimaConfig and allow user to configure it (remove getFlatOptions use) Properties props = LimaMain.config.getFlatOptions(); + // transmission des options de logging a openejb + // sinon, il utilise son propre pattern interne + InputStream log4jFile = null; + try { + log4jFile = LimaServiceFactory.class.getResourceAsStream("/log4j.properties"); + Properties propsLog4j = new Properties(); + propsLog4j.load(log4jFile); + props.putAll(propsLog4j); + } catch (IOException ex) { + if (log.isErrorEnabled()) { + log.error("Can't find log4j properties file", ex); + } + } + finally { + IOUtils.closeQuietly(log4jFile); + } + // Context.INITIAL_CONTEXT_FACTORY is a mandatory option // containsKey() does'nt work :( if (!props.containsKey(Context.INITIAL_CONTEXT_FACTORY)) {
participants (1)
-
echatellier@users.chorem.org