cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r386147 - /cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
Date Wed, 15 Mar 2006 19:32:27 GMT
Author: cziegeler
Date: Wed Mar 15 11:32:26 2006
New Revision: 386147

URL: http://svn.apache.org/viewcvs?rev=386147&view=rev
Log:
Implement override log level

Modified:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java?rev=386147&r1=386146&r2=386147&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
Wed Mar 15 11:32:26 2006
@@ -192,7 +192,7 @@
                 final Configuration conf = builder.build(servletContext.getResourceAsStream(loggerConfig));
                 // override log level?
                 if (settings.getOverrideLogLevel() != null) {
-                    // TODO - override loglevel for log4j
+                    changeLogLevel(conf.getChildren(), settings.getOverrideLogLevel());
                 }
                 loggerManager.configure(conf);
             } else {
@@ -208,6 +208,16 @@
             accesslogger = "cocoon";
         }
         return loggerManager.getLoggerForCategory(accesslogger);
+    }
+
+    protected static void changeLogLevel(Configuration[] configs, String level) {
+        for(int i=0; i<configs.length; i++) {
+            if ( configs[i].getName().equals("priority") ) {
+                // we now that this is a DefaultConfiguration
+                ((DefaultConfiguration)configs[i]).setAttribute("value", level);
+            }
+            changeLogLevel(configs[i].getChildren(), level);
+        }
     }
 
     protected static void prepareBeanFactory(CocoonBeanFactory factory,



Mime
View raw message