Hi people,

The ContextManager trys to log "Done" after shutting down the
loggerManager which causes a [FATAL ERROR] message to be logged to
console.

I have attached a patch file to this email which fixes this problem by
shutting down the loggerManager separately from the rest of the "owned"
items and without printing a "done" message.

cheers,
Michael Melhem
Index: src/impl/org/apache/avalon/fortress/util/ContextManager.java
===================================================================
RCS file: 
/home/cvspublic/avalon/fortress/container/src/impl/org/apache/avalon/fortress/util/ContextManager.java,v
retrieving revision 1.48
diff -u -r1.48 ContextManager.java
--- src/impl/org/apache/avalon/fortress/util/ContextManager.java        27 Jun 2003 
18:30:59 -0000      1.48
+++ src/impl/org/apache/avalon/fortress/util/ContextManager.java        15 Sep 2003 
13:07:36 -0000
@@ -392,6 +392,26 @@
      */
     public void dispose()
     {
+        // Dispose all items owned by ContextManager 
+        disposeOwned();
+
+        // Now dispose the Logger (cannot log to logger after its shutdown)
+        if ( getLogger().isDebugEnabled() ) getLogger().debug( "Shutting down: " + 
m_loggerManager );
+
+        try {
+            ContainerUtil.shutdown( m_loggerManager );
+        } catch (Exception ex) {
+            if (  m_primordialLogger.isDebugEnabled() ) { 
+                 m_primordialLogger.debug( "Failed to shutdown loggerManager", ex );
+             }
+        }
+    }
+
+    /**
+     * Disposes all items ContextManager has assumed ownership over 
+     */
+    public void disposeOwned()
+    {
         Collections.sort( ownedComponents, new DestroyOrderComparator() );
         // Dispose owned components
         final Iterator ownedComponentsIter = ownedComponents.iterator();
@@ -916,7 +936,6 @@
             ContainerUtil.contextualize( m_loggerManager, m_rootContext );
             ContainerUtil.configure( m_loggerManager, loggerManagerConfig );
             ContainerUtil.start( m_loggerManager );
-            assumeOwnership( m_loggerManager );
         }
 
         // Since we now have a LoggerManager, we can update the this.logger field

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

Reply via email to