avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/logging DefaultLoggingManager.java
Date Tue, 15 Apr 2003 02:51:17 GMT
mcconnell    2003/04/14 19:51:17

  Modified:    merlin/assembly/src/java/org/apache/avalon/assembly/logging
                        DefaultLoggingManager.java
  Log:
  The logging manager has ben extended to include support for the explicit declaration of
a system logging root category and operations enabaling the creation of system sub-categories
for components constructed by Merlin that are internal to the Merlin system.
  
  Revision  Changes    Path
  1.3       +43 -2     avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/logging/DefaultLoggingManager.java
  
  Index: DefaultLoggingManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/logging/DefaultLoggingManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultLoggingManager.java	11 Apr 2003 20:19:38 -0000	1.2
  +++ DefaultLoggingManager.java	15 Apr 2003 02:51:16 -0000	1.3
  @@ -127,7 +127,7 @@
       private Hierarchy m_logHierarchy;
   
       /**
  -     * The efault logging channel.
  +     * The default logging channel.
        */
       private org.apache.avalon.framework.logger.Logger m_logger;
   
  @@ -136,6 +136,8 @@
        */
       private final HashMap m_targets = new HashMap();
   
  +    private String m_system = SYSTEM_CATEGORY_DEFAULT;
  +
       //==============================================================
       // Contextualizable
       //==============================================================
  @@ -149,6 +151,16 @@
       public void contextualize( Locator context ) throws ContextException
       {
           m_baseDirectory = (File) context.get( "urn:assembly:home" );
  +        if( context.hasEntry( SYSTEM_CATEGORY_KEY ) )
  +        {
  +            m_system = (String) context.get( SYSTEM_CATEGORY_KEY );
  +            if( m_system.startsWith( "/" ) || m_system.startsWith( "." ) )
  +            {
  +                final String error = 
  +                  "Invalid system category - cannot start with '.' or '/' character.";
  +                throw new IllegalArgumentException( error );
  +            }
  +        }
   
           try
           {
  @@ -163,7 +175,7 @@
       }
   
       //===============================================================
  -    // Initilizable
  +    // Initializable
       //===============================================================
   
       /**
  @@ -272,6 +284,35 @@
           }
       }
   
  +    /**
  +     * Add a set of category entries relative to the system category
  +     * using the supplied descriptor as the definition of subcategories.
  +     * @param path the category base path
  +     * @param descriptor a set of category descriptors to be added under
  +     *   the system path
  +     */
  +    public void addSystemCategories( String path, LoggingDirective descriptor )
  +    {
  +        final String category = convertToSystem( path );
  +        addCategories( category, descriptor );
  +    }
  +
  +    /**
  +     * Create a system logging channel.
  +     *
  +     * @param path the category path
  +     * @return the logging channel
  +     */
  +    public org.apache.avalon.framework.logger.Logger getSystemLoggerForCategory( final
String path )
  +    {
  +        final String category = convertToSystem( path );
  +        return getLoggerForCategory( category );
  +    }
  +
  +    private String convertToSystem( String path )
  +    {
  +        return m_system + "." + filter( path );
  +    }
   
       /**
        * Create a logging channel configured with the supplied category path,
  
  
  

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


Mime
View raw message