You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/03/15 04:10:53 UTC

cvs commit: jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/logger AbstractLoggable.java Loggable.java

donaldp     01/03/14 19:10:53

  Added:       proposal/4.0/src/java/org/apache/avalon/logger
                        AbstractLoggable.java Loggable.java
  Log:
  Moved *Loggable to org.apache.avalon.logger
  Made the ComponentManager throw ComponentException again
  
  Revision  Changes    Path
  1.1                  jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/logger/AbstractLoggable.java
  
  Index: AbstractLoggable.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.logger;
  
  import org.apache.avalon.component.Component;
  import org.apache.log.Logger;
  
  /**
   * Helper class to inherit from.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public abstract class AbstractLoggable
      implements Component, Loggable
  {
      protected Logger    m_logger;
  
      public void setLogger( final Logger logger )
      {
          m_logger = logger;
      }
  
      protected final Logger getLogger()
      {
          return m_logger;
      }
  
      protected void setupLogger( final Component component )
      {
          setupLogger( component, (String)null );
      }
  
      protected void setupLogger( final Component component, final String subCategory )
      {
          if( component instanceof Loggable )
          {
              Logger logger = m_logger;
  
              if( null != subCategory )
              {
                  logger = m_logger.getChildLogger( subCategory );
              }
              
              ((Loggable)component).setLogger( logger );
          }
      }
  
      protected void setupLogger( final Component component, final Logger logger )
      {
          if( component instanceof Loggable )
          {
              ((Loggable)component).setLogger( logger );
          }
      }
  }
  
  
  
  1.1                  jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/logger/Loggable.java
  
  Index: Loggable.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.logger;
  
  import org.apache.log.Logger;
  
  /**
   * Interface through which to provide Loggers.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface Loggable
  {
      void setLogger( Logger logger );
  }
  
  
  

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