Hi All,

Another patch fixes current problem in ECM wrt logging: components nested in selectors don't get proper logger (getChildLogger does not return logger with correct targets).

Can sombody review?

Thanks,
Vadim
Index: 
containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LoggerManageable.java
===================================================================
--- 
containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LoggerManageable.java
       (revision 0)
+++ 
containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LoggerManageable.java
       (revision 0)
@@ -0,0 +1,38 @@
+/* 
+ * Copyright 2005 The Apache Software Foundation
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ * 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avalon.excalibur.logger;
+
+/**
+ * LoggerManageable interface, use this to set the [EMAIL PROTECTED] 
LoggerManager}
+ * for the child components.
+ *
+ * <p>Replaces LogKitManageable.</p>
+ *
+ * @author <a href="mailto:[email protected]";>Avalon Development Team</a>
+ * @version CVS $Revision: 1.8 $ $Date: 2004/03/10 13:54:50 $
+ * @since 4.0
+ */
+public interface LoggerManageable
+{
+    /**
+     * Sets the LoggerManager for child components. Can be used for special
+     * purpose components, however it is used mostly internally.
+     *
+     * @param loggerManager The LoggerManager for child components.
+     */
+    void setLoggerManager( final LoggerManager loggerManager );
+}

Property changes on: 
containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LoggerManageable.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: 
deprecated/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java
===================================================================
--- 
deprecated/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java
    (revision 159689)
+++ 
deprecated/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java
    (working copy)
@@ -20,6 +20,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.avalon.excalibur.logger.LoggerManageable;
 import org.apache.avalon.excalibur.logger.LogKitManageable;
 import org.apache.avalon.excalibur.pool.ObjectFactory;
 import org.apache.avalon.framework.activity.Disposable;
@@ -54,53 +55,68 @@
     extends AbstractDualLogEnabled
     implements ObjectFactory, Disposable, ThreadSafe
 {
-    /** The class which this <code>ComponentFactory</code>
+    /**
+     * The class which this <code>ComponentFactory</code>
      * should create.
      */
     private Class m_componentClass;
 
-    /** The Context for the component
+    /**
+     * The Context for the component
      */
     private Context m_context;
 
-    /** The component manager for this component.
+    /**
+     * The component manager for this component.
      */
     private ComponentManager m_componentManager;
 
-    /** The service manager for this component
+    /**
+     * The service manager for this component
      */
     private WrapperServiceManager m_serviceManager;
     
-    /** The configuration for this component.
+    /**
+     * The configuration for this component.
      */
     private Configuration m_configuration;
 
-    /** The RoleManager for child ComponentSelectors
+    /**
+     * The RoleManager for child ComponentSelectors
      */
     private RoleManager m_roles;
 
-    /** The LogkitLoggerManager for child ComponentSelectors
+    /**
+     * The LogkitLoggerManager for child ComponentSelectors
      */
     private LogkitLoggerManager m_loggerManager;
 
-    /** Components created by this factory, and their associated 
ComponentLocator
-     *  proxies, if they are Composables.  These must be seperate maps in case
-     *  a component falls into more than one category, which they often do.
+    /**
+     * Components created by this factory, and their associated 
ComponentLocator
+     * proxies, if they are Composables.  These must be seperate maps in case
+     * a component falls into more than one category, which they often do.
      */
     private final Map m_componentProxies = Collections.synchronizedMap(new 
HashMap());
 
-    /** Instrument Manager to register objects created by this factory with 
(May be null). */
+    /**
+     * Instrument Manager to register objects created by this factory with
+     * (may be null).
+     */
     private InstrumentManager m_instrumentManager;
 
-    /** Instrumentable Name assigned to objects created by this factory. */
+    /**
+     * Instrumentable Name assigned to objects created by this factory.
+     */
     private String m_instrumentableName;
 
     private ComponentProxyGenerator m_proxyGenerator;
     private String m_role;
 
+
     /*---------------------------------------------------------------
      * Constructors
      *-------------------------------------------------------------*/
+
     /**
      * Construct a new component factory for the specified component.
      *
@@ -261,8 +277,12 @@
             ( (RoleManageable)component ).setRoleManager( m_roles );
         }
 
-        if( component instanceof LogKitManageable )
+        if( component instanceof LoggerManageable )
         {
+            ( (LoggerManageable)component ).setLoggerManager( m_loggerManager 
);
+        }
+        else if( component instanceof LogKitManageable )
+        {
             ( (LogKitManageable)component ).setLogKitManager( 
m_loggerManager.getLogKitManager() );
         }
 
Index: 
deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
===================================================================
--- 
deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
 (revision 159689)
+++ 
deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
 (working copy)
@@ -23,9 +23,10 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.avalon.excalibur.logger.LoggerManageable;
+import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.excalibur.logger.LogKitManageable;
 import org.apache.avalon.excalibur.logger.LogKitManager;
-import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.component.Component;
@@ -64,6 +65,7 @@
     Disposable,
     RoleManageable,
     LogKitManageable,
+    LoggerManageable,
     InstrumentManageable,
     Instrumentable
 {
Index: 
deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
===================================================================
--- 
deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
  (revision 159689)
+++ 
deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
  (working copy)
@@ -23,9 +23,10 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.avalon.excalibur.logger.LoggerManageable;
+import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.excalibur.logger.LogKitManageable;
 import org.apache.avalon.excalibur.logger.LogKitManager;
-import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.component.Component;
@@ -60,6 +61,7 @@
     Disposable,
     RoleManageable,
     LogKitManageable,
+    LoggerManageable,
     InstrumentManageable,
     Instrumentable
 {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to