geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r764388 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ApplicationLog4jConfigurationGBean.java
Date Mon, 13 Apr 2009 10:00:59 GMT
Author: xuhaihong
Date: Mon Apr 13 10:00:59 2009
New Revision: 764388

URL: http://svn.apache.org/viewvc?rev=764388&view=rev
Log:
GERONIMO-4615 Make the client application could use their own Log4j configuration with ApplicationLog4jConfigurationGBean

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ApplicationLog4jConfigurationGBean.java

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ApplicationLog4jConfigurationGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ApplicationLog4jConfigurationGBean.java?rev=764388&r1=764387&r2=764388&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ApplicationLog4jConfigurationGBean.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ApplicationLog4jConfigurationGBean.java
Mon Apr 13 10:00:59 2009
@@ -30,7 +30,6 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.log4j.PropertyConfigurator;
 
 /**
  * @version $Rev$ $Date$
@@ -62,20 +61,25 @@
         } finally {
             in.close();
         }
-        //remove any global log4j configuration
-        for (Iterator it = props.keySet().iterator(); it.hasNext(); ) {
-            String key = (String) it.next();
-            if (key.startsWith(CATEGORY_PREFIX)
-                    || key.startsWith(LOGGER_PREFIX)
-                    || key.startsWith(ADDITIVITY_PREFIX)
-                    || key.startsWith(APPENDER_PREFIX)
-                    || key.startsWith(RENDERER_PREFIX)) {
-                continue;
+        try {
+            Class log4jConfigClass = classloader.loadClass("org.apache.log4j.PropertyConfigurator");
+            if (log4jConfigClass.getClassLoader() == ClassLoader.getSystemClassLoader())
{
+                //remove any global log4j configuration
+                for (Iterator it = props.keySet().iterator(); it.hasNext();) {
+                    String key = (String) it.next();
+                    if (key.startsWith(CATEGORY_PREFIX)
+                            || key.startsWith(LOGGER_PREFIX)
+                            || key.startsWith(ADDITIVITY_PREFIX)
+                            || key.startsWith(APPENDER_PREFIX)
+                            || key.startsWith(RENDERER_PREFIX)) {
+                        continue;
+                    }
+                    it.remove();
+                }
             }
-            it.remove();
+            log4jConfigClass.getMethod("configure", Properties.class).invoke(null, props);
+        } catch (Exception e) {        
         }
-
-        PropertyConfigurator.configure(props);
     }
 
     public static final GBeanInfo GBEAN_INFO;



Mime
View raw message