You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by at...@apache.org on 2003/06/10 10:35:15 UTC

cvs commit: avalon/fortress/container/src/impl/org/apache/avalon/fortress/util ContextManager.java

atagunov    2003/06/10 01:35:15

  Modified:    fortress/container/src/impl/org/apache/avalon/fortress/util
                        ContextManager.java
  Log:
  upgrading to the new *LoggerManager constructors
  
  Revision  Changes    Path
  1.2       +35 -50    avalon/fortress/container/src/impl/org/apache/avalon/fortress/util/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/avalon/fortress/container/src/impl/org/apache/avalon/fortress/util/ContextManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextManager.java	9 Jun 2003 15:27:41 -0000	1.1
  +++ ContextManager.java	10 Jun 2003 08:35:15 -0000	1.2
  @@ -122,10 +122,10 @@
    * @version CVS $Revision$ $Date$
    * @since 4.1
    */
  -public final class ContextManager
  +public class ContextManager
           implements ContextManagerConstants, Initializable, Disposable
   {
  -    private static final Configuration EMPTY_CONFIG;
  +    protected static final Configuration EMPTY_CONFIG;
   
       static
       {
  @@ -719,6 +719,7 @@
           manager.makeReadOnly();
   
           m_containerManagerContext.put( SERVICE_MANAGER, manager );
  +        m_childContext.put( SERVICE_MANAGER, manager );
       }
   
       /**
  @@ -846,9 +847,9 @@
               }
               else
               {
  -                /**
  +                /*
                    * We rely on namespace handing being turned off in DefaultConfiguration
  -                 * builder here. TODO: add code that test
  +                 * builder here. TODO: add code that tests
                    * root element for name "configuration" and for the correct Log4J
                    * configuration namespace (not currently known to me - Anton Tagunov)
                    * to survive if a namespace-enabled configuration has been passed to us.
  @@ -865,62 +866,46 @@
               }
   
               final String lmDefaultLoggerName =
  -                    (String) m_rootContext.get( ContextManagerConstants.LOG_CATEGORY );
  +                    (String) get( m_rootContext, ContextManagerConstants.LOG_CATEGORY, "fotress" );
               final String lmLoggerName = loggerManagerConfig.getAttribute( "logger",
  -                    lmDefaultLoggerName + ( log4j ? ".system.log4j" : ".system.logkit" ) );
  +                    log4j ? "system.log4j" : "system.logkit" );
   
               if ( log4j )
               {
  -                // this section totally not debuged, just written - Anton Tagunov
  -                final Log4JConfLoggerManager logManager = new Log4JConfLoggerManager();
  -                logManager.configure( loggerManagerConfig );
  -                // Create the logger for use internally by the Logger Manager.
  -                Logger lmLogger = logManager.getLoggerForCategory( lmLoggerName );
  -                /*
  -                 * We rely here on specifics of Log4JConfLoggerManager implementation:
  -                 * enableLogging may be called _after_ configure.
  -                 */
  -                logManager.enableLogging( lmLogger );
  -
                   /**
  -                 * Now let's compare this immature section with the mature one
  -                 * bellow: we haven't made sure the default logger is at DEBUG
  -                 * priority level, we haven't considered log-level attribute
  -                 * on the root element to set the priority of the logger
  -                 * servicing Log4LoggerManager itself. Moreover we have
  -                 * enableLogging called after configure on Log4ConfLoggerManager
  -                 * which is potentially explosive. Conclusion: this section
  -                 * is just a scetch and needs further work. - Anton Tagunov
  +                 * Working around a weird compilation problem: with JDK 1.4.1-b21
  +                 * on Win2K couldn't get the following statement to compile:
  +                 *
  +                 * m_loggerManager = 
  +                 *         new Log4JConfLoggerManager( lmDefaultLoggerName, lmLoggerName );
  +                 *
  +                 * javac kept complaining:
  +                 *
  +                 * file org\apache\log4j\spi\LoggerRepository.class not found
  +                 *           new Log4JConfLoggerManager( lmDefaultLoggerName, lmLoggerName );
  +                 *
  +                 * ... ContextManager.java:xxx: cannot access org.apache.log4j.spi.LoggerRepository
  +                 * file org\apache\log4j\spi\LoggerRepository.class not found
  +                 * m_loggerManager = new Log4JConfLoggerManager( lmDefaultLoggerName, lmLoggerName );
  +                 *                 ^
  +                 *
  +                 * - Anton Tagunov
                    */
  -
  -                m_loggerManager = logManager;
  +                m_loggerManager = Log4JConfLoggerManager.newInstance( 
  +                        lmDefaultLoggerName, lmLoggerName );
               }
               else // LogKitLoggerManager
               {
  -                // Create the default logger for the Logger Manager.
  -                final org.apache.log.Logger lmDefaultLogger =
  -                        Hierarchy.getDefaultHierarchy().getLoggerFor( lmDefaultLoggerName );
  -                // The default logger is not used until after the logger conf has been loaded
  -                //  so it is possible to configure the priority there.
  -                lmDefaultLogger.setPriority( Priority.DEBUG );
  -
  -                // Create the logger for use internally by the Logger Manager.
  -                final org.apache.log.Logger lmLogger =
  -                        Hierarchy.getDefaultHierarchy().getLoggerFor( lmLoggerName );
  -                lmLogger.setPriority( Priority.getPriorityForName(
  -                        loggerManagerConfig.getAttribute( "log-level", "DEBUG" ) ) );
  -
                   // Setup the Logger Manager
  -                final LoggerManager logManager = new LogKitLoggerManager(
  -                        lmDefaultLoggerName, Hierarchy.getDefaultHierarchy(),
  -                        new LogKitLogger( lmDefaultLogger ), new LogKitLogger( lmLogger ) );
  -                ContainerUtil.contextualize( logManager, m_rootContext );
  -                ContainerUtil.configure( logManager, loggerManagerConfig );
  -
  -                assumeOwnership( logManager );
  -
  -                m_loggerManager = logManager;
  +                m_loggerManager = new LogKitLoggerManager( 
  +                        lmDefaultLoggerName, lmLoggerName );
               }
  +
  +            ContainerUtil.enableLogging( m_loggerManager, getLogger() );
  +            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: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Re: cvs commit: avalon/fortress/container/src/impl/org/apache/avalon/fortress/util ContextManager.java

Posted by Leo Simons <le...@apache.org>.
Anton Tagunov wrote:
> I have just commited some changes to ContextManager.java
> in fortress. As now fortress (temprarily) lives in two places
> I have commited to both (to be on the safe side :-)

that's not really neccessary. Right now I've just put soures in place to 
  test the new builds. When it is time to move I will copy sources on 
the server so we will also retain cvs history and stoof.

> I'm afraid this means that you have uploaded not the
> very freshest Fortress :-(

yep :D

don't worry, just commit in the "old"/current location; I'll sort all 
that out!

- LSD



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: cvs commit: avalon/fortress/container/src/impl/org/apache/avalon/fortress/util ContextManager.java

Posted by Anton Tagunov <at...@mail.cnt.ru>.
Hello Leo!

I have just commited some changes to ContextManager.java
in fortress. As now fortress (temprarily) lives in two places
I have commited to both (to be on the safe side :-)

Please compare my two commit messages.
The commit to the old location of sources really contains
only my new changes. But the other commit also contains
changes that have been done before.

I'm afraid this means that you have uploaded not the
very freshest Fortress :-(

aao>   Modified:    fortress/container/src/impl/org/apache/avalon/fortress/util
aao>                         ContextManager.java
aao>   -public final class ContextManager
aao>   +public class ContextManager

this is change that has been done some time before.
The fact it was submitted by last patch signals that
I had a newer version in my checkout from
   avalon-excalibur/fortress
there there was in the cvs at
   avalon/fortress

Hate to bring bad news, but...

WBR, Anton


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org