avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/testcase ExcaliburTestCase.java
Date Wed, 20 Feb 2002 10:24:55 GMT
leif        02/02/20 02:24:55

  Modified:    src/java/org/apache/avalon/excalibur/testcase
                        ExcaliburTestCase.java
  Log:
  Modify the logger names so that the Role, Logkit and Component
  managers each get their own loggers and added banners to divide test
  output when debugging is enabled.  Makes it much easier to debug
  the output of tests.
  
  Revision  Changes    Path
  1.18      +25 -6     jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/testcase/ExcaliburTestCase.java
  
  Index: ExcaliburTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/testcase/ExcaliburTestCase.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ExcaliburTestCase.java	13 Feb 2002 03:27:47 -0000	1.17
  +++ ExcaliburTestCase.java	20 Feb 2002 10:24:54 -0000	1.18
  @@ -146,7 +146,7 @@
    * </pre>
    *
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version $Id: ExcaliburTestCase.java,v 1.17 2002/02/13 03:27:47 leif Exp $
  + * @version $Id: ExcaliburTestCase.java,v 1.18 2002/02/20 10:24:54 leif Exp $
    */
   public class ExcaliburTestCase
       extends TestCase
  @@ -191,13 +191,13 @@
               ExcaliburTestCase.m_tests.put( this.getClass(), methodList );
           }
       }
  -
  +    
       /** Return the logger */
       protected Logger getLogger()
       {
           if ( null == m_logger )
           {
  -            m_logger = this.setupLogger();
  +            m_logger = this.setupLogger( getName() );
           }
   
           return m_logger;
  @@ -225,6 +225,10 @@
       {
           final String resourceName = this.getClass().getName().replace( '.', '/' ) + ".xtest";
           URL resource = this.getClass().getClassLoader().getResource( resourceName );
  +        
  +        // Set the logger for the initialization phase.
  +        m_logger = setupLogger( "testcase" );
  +        
           if ( resource != null ) {
               getLogger().debug("Loading resource " + resourceName);
               prepare( resource.openStream() );
  @@ -312,10 +316,21 @@
   
                   if ( this.getLogger().isDebugEnabled() )
                   {
  -                    this.getLogger().debug("Now running the following test: " + methodName);
  +                    this.getLogger().debug("");
  +                    this.getLogger().debug("================================================================================");
  +                    this.getLogger().debug("  begin test: " + methodName);
  +                    this.getLogger().debug("================================================================================");
                   }
   
                   super.run(result);
  +                
  +                if ( this.getLogger().isDebugEnabled() )
  +                {
  +                    this.getLogger().debug("================================================================================");
  +                    this.getLogger().debug("  end test: " + methodName);
  +                    this.getLogger().debug("================================================================================");
  +                    this.getLogger().debug("");
  +                }
               }
   
           }
  @@ -347,12 +362,12 @@
       /**
        * Set up logger configuration
        */
  -    final private Logger setupLogger()
  +    final private Logger setupLogger( String name )
       {
           //FIXME(GP): This method should setup a LogConfigurator and LogManager
           //           according to the configuration spec. not yet completed/implemented
           //           It will return a default logger for now.
  -        final org.apache.log.Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor(
getName() );
  +        final org.apache.log.Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor(
name );
           logger.setPriority( m_logPriority );
   
           final PatternFormatter formatter = new PatternFormatter( FORMAT );
  @@ -410,15 +425,19 @@
                                                                       final Context context
)
           throws Exception
       {
  +        // Create a loggers for each of the managers so that they will get the correct
logger.
  +        m_logger = setupLogger( "rm" );
           final DefaultRoleManager roleManager = new DefaultRoleManager();
           roleManager.setLogger( getLogger() );
           roleManager.configure( confRM );
   
  +        m_logger = setupLogger( "lm" );
           final DefaultLogKitManager logKitManager = new DefaultLogKitManager();
           logKitManager.enableLogging( getLogEnabledLogger() );
           logKitManager.contextualize( context );
           logKitManager.configure( confLM );
   
  +        m_logger = setupLogger( "cm" );
           final ExcaliburComponentManager manager = new ExcaliburComponentManager();
           manager.setLogger( getLogger() );
           manager.setRoleManager( roleManager );
  
  
  

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


Mime
View raw message