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/logger/src/java/org/apache/avalon/excalibur/logger DefaultLogKitManager.java
Date Mon, 10 Mar 2003 14:29:00 GMT
bloritsch    2003/03/10 06:29:00

  Modified:    logger/src/java/org/apache/avalon/excalibur/logger
                        DefaultLogKitManager.java
  Log:
  Add additional feature so that we can keep debug targets
  separate from production targets.  The absense of the
  debug file does not break functionality.
  
  Revision  Changes    Path
  1.6       +30 -1     avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/DefaultLogKitManager.java
  
  Index: DefaultLogKitManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/DefaultLogKitManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultLogKitManager.java	25 Feb 2003 16:28:24 -0000	1.5
  +++ DefaultLogKitManager.java	10 Mar 2003 14:28:59 -0000	1.6
  @@ -49,12 +49,14 @@
   */
   package org.apache.avalon.excalibur.logger;
   
  +import java.io.File;
   import java.util.HashMap;
   import java.util.Map;
   
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.ContextException;
  @@ -189,6 +191,10 @@
   
       /**
        * Reads a configuration object and creates the category mapping.
  +     * If the <code>&lt;categories/&gt;</code> element has an attribute
  +     * named <code>debug</code>, it will try to load a configuration file
  +     * specified by that attribute.  The contents of that configuration
  +     * file will be the same as the <code>&lt;categories/&gt;</code>
element.
        *
        * @param configuration  The configuration object.
        * @throws ConfigurationException if the configuration is malformed
  @@ -203,8 +209,31 @@
           final LogTargetManager targetManager = setupTargetManager( targets, targetFactoryManager
);
   
           final Configuration categories = configuration.getChild( "categories" );
  +        final String debugURL = configuration.getAttribute("debug", null);
           final Configuration[] category = categories.getChildren( "category" );
           setupLoggers( targetManager, m_prefix, category );
  +        
  +        if ( null != debugURL )
  +        {
  +            try
  +            {
  +                final File rootContext = (File)m_context.get("context-root");
  +                DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
  +                Configuration debugCategories = builder.buildFromFile(new File(rootContext,
debugURL));
  +                final Configuration[] debugCat = debugCategories.getChildren("category");
  +                setupLoggers( targetManager, m_prefix, debugCat);
  +            }
  +            catch (ConfigurationException ce)
  +            {
  +                throw ce;
  +            }
  +            catch (Exception e)
  +            {
  +                getLogger().info("Either there was no \"debug.xlog\" file, or there was
a problem reading it.");
  +                getLogger().debug(e.getMessage(), e);
  +                // swallow exception because it is not critical.
  +            }
  +        }
       }
   
       /**
  
  
  

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


Mime
View raw message