avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject cvs commit: avalon-phoenix/src/java/org/apache/avalon/phoenix/components/logger DefaultLogManager.java
Date Thu, 20 Mar 2003 02:44:25 GMT
proyal      2003/03/19 18:44:24

  Modified:    src/java/org/apache/avalon/phoenix/components/logger
                        DefaultLogManager.java
  Log:
  Make phoenix.home available to loggers.
  
  Fixes http://jira.codehaus.org/secure/ViewIssue.jspa?key=PNIX-4
  
  Revision  Changes    Path
  1.29      +27 -2     avalon-phoenix/src/java/org/apache/avalon/phoenix/components/logger/DefaultLogManager.java
  
  Index: DefaultLogManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/logger/DefaultLogManager.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DefaultLogManager.java	16 Mar 2003 01:46:57 -0000	1.28
  +++ DefaultLogManager.java	20 Mar 2003 02:44:24 -0000	1.29
  @@ -7,6 +7,8 @@
    */
   package org.apache.avalon.phoenix.components.logger;
   
  +import java.io.File;
  +
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.logger.LogKitLoggerManager;
  @@ -15,6 +17,9 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.avalon.framework.context.ContextException;
  +import org.apache.avalon.framework.context.Contextualizable;
  +import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.phoenix.BlockContext;
  @@ -27,7 +32,7 @@
    */
   public class DefaultLogManager
       extends AbstractLogEnabled
  -    implements LogManager
  +    implements LogManager, Contextualizable
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultLogManager.class );
  @@ -49,6 +54,26 @@
           "org.apache.avalon.excalibur.logger.Log4JConfLoggerManager";
   
       /**
  +     * Hold the value of phoenix.home
  +     */
  +    private File m_phoenixHome;
  +
  +    public void contextualize( final Context context ) throws ContextException
  +    {
  +        m_phoenixHome = (File)context.get( "phoenix.home" );
  +    }
  +
  +    private Context createLoggerManagerContext( final Context appContext )
  +    {
  +        final DefaultContext context = new DefaultContext( appContext );
  +
  +        context.put( "phoenix.home", m_phoenixHome );
  +        context.makeReadOnly();
  +
  +        return context;
  +    }
  +
  +    /**
        * Create a Logger hierarchy for specified application.
        *
        * @param logs the configuration data for logging
  @@ -71,7 +96,7 @@
           }
           final LoggerManager loggerManager = createLoggerManager( version );
           ContainerUtil.enableLogging( loggerManager, getLogger() );
  -        ContainerUtil.contextualize( loggerManager, context );
  +        ContainerUtil.contextualize( loggerManager, createLoggerManagerContext( context
) );
           ContainerUtil.configure( loggerManager, logs );
           return loggerManager.getDefaultLogger();
       }
  
  
  

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


Mime
View raw message