avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util ContextManager.java FortressConfig.java
Date Wed, 19 Mar 2003 17:46:29 GMT
bloritsch    2003/03/19 09:46:29

  Modified:    fortress/src/java/org/apache/avalon/fortress/impl
                        DefaultContainerManager.java
               fortress/src/java/org/apache/avalon/fortress/util
                        ContextManager.java FortressConfig.java
  Log:
  provide more intelligent defaults for context and temp directories, as well as better use
of the root logger so I can see the proper log categories in my log file
  
  Revision  Changes    Path
  1.8       +16 -2     avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java
  
  Index: DefaultContainerManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultContainerManager.java	7 Mar 2003 20:21:26 -0000	1.7
  +++ DefaultContainerManager.java	19 Mar 2003 17:46:28 -0000	1.8
  @@ -53,6 +53,7 @@
   import org.apache.avalon.fortress.InitializationException;
   import org.apache.avalon.fortress.RoleManager;
   import org.apache.avalon.fortress.util.ContextManager;
  +import org.apache.avalon.fortress.util.ContextManagerConstants;
   import org.apache.avalon.fortress.util.LifecycleExtensionManager;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
  @@ -142,7 +143,20 @@
       {
           try
           {
  -            return ( (LoggerManager)initParameters.get( LoggerManager.ROLE ) ).getDefaultLogger();
  +            String logCategory = (String)initParameters.get( ContextManagerConstants.LOG_CATEGORY
);
  +            LoggerManager loggerManager = (LoggerManager)initParameters.get( LoggerManager.ROLE
);
  +            Logger logger;
  +            
  +            if (null == logCategory)
  +            {
  +                logger = loggerManager.getDefaultLogger();
  +            }
  +            else
  +            {
  +                logger = loggerManager.getLoggerForCategory(logCategory);
  +            }
  +
  +            return logger;
           }
           catch( ContextException ce )
           {
  
  
  
  1.10      +4 -19     avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ContextManager.java	19 Mar 2003 12:55:48 -0000	1.9
  +++ ContextManager.java	19 Mar 2003 17:46:29 -0000	1.10
  @@ -762,24 +762,9 @@
                   }
               }
   
  -            // Resolve the prefix to use for this Logger Manager
  -            String logPrefix = (String)get( m_rootContext, LOG_CATEGORY,
  -                                            get( m_childContext, LOG_CATEGORY, null ) );
  -
               // Resolve a name for the logger, taking the logPrefix into account
  -            String lmDefaultLoggerName;
  -            String lmLoggerName;
  -            if( logPrefix == null )
  -            {
  -                lmDefaultLoggerName = "";
  -                lmLoggerName = loggerManagerConfig.getAttribute( "logger", "system.logkit"
);
  -            }
  -            else
  -            {
  -                lmDefaultLoggerName = logPrefix;
  -                lmLoggerName = logPrefix + org.apache.log.Logger.CATEGORY_SEPARATOR
  -                    + loggerManagerConfig.getAttribute( "logger", "system.logkit" );
  -            }
  +            String lmDefaultLoggerName = "";
  +            String lmLoggerName = loggerManagerConfig.getAttribute( "logger", "system.logkit"
);
   
               // Create the default logger for the Logger Manager.
               org.apache.log.Logger lmDefaultLogger =
  @@ -796,7 +781,7 @@
   
               // Setup the Logger Manager
               LoggerManager logManager = new LogKitLoggerManager(
  -                logPrefix, Hierarchy.getDefaultHierarchy(),
  +                lmDefaultLoggerName, Hierarchy.getDefaultHierarchy(),
                   new LogKitLogger( lmDefaultLogger ), new LogKitLogger( lmLogger ) );
               ContainerUtil.contextualize( logManager, m_rootContext );
               ContainerUtil.configure( logManager, loggerManagerConfig );
  
  
  
  1.7       +6 -3      avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/FortressConfig.java
  
  Index: FortressConfig.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/FortressConfig.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FortressConfig.java	19 Mar 2003 12:55:48 -0000	1.6
  +++ FortressConfig.java	19 Mar 2003 17:46:29 -0000	1.7
  @@ -123,10 +123,13 @@
               // ignore
           }
   
  +        File contextDir = new File( System.getProperty( "user.dir" ) );
  +        File workDir = new File( System.getProperty( "java.io.tmpdir" ) );
  +        
           defaultContext.put( ContextManagerConstants.THREADS_CPU, new Integer( 2 ) );
           defaultContext.put( ContextManagerConstants.THREAD_TIMEOUT, new Long( 1000 ) );
  -        defaultContext.put( ContextManagerConstants.CONTEXT_DIRECTORY, new File( "../"
) );
  -        defaultContext.put( ContextManagerConstants.WORK_DIRECTORY, new File( "/tmp" )
);
  +        defaultContext.put( ContextManagerConstants.CONTEXT_DIRECTORY, contextDir );
  +        defaultContext.put( ContextManagerConstants.WORK_DIRECTORY, workDir );
           defaultContext.put( ContextManagerConstants.LOG_CATEGORY, "fortress" );
           defaultContext.put( ClassLoader.class.getName(), classLoader );
           defaultContext.put( ContextManagerConstants.CONFIGURATION_URI, "conf/system.xconf"
);
  
  
  

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


Mime
View raw message