avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon/src/proposal/loggable-v2 Loggable.java Logger.java
Date Wed, 31 Oct 2001 15:45:51 GMT
bloritsch    01/10/31 07:45:51

  Modified:    .        build.xml
               src/java/org/apache/avalon/framework/logger
                        AbstractLoggable.java Loggable.java
  Added:       src/java/org/apache/avalon/framework/logger Log4JLogger.java
                        LogKitLogger.java Logger.java
  Removed:     src/proposal/loggable-v2 Loggable.java Logger.java
  Log:
  Support for LogKit and Log4J with new logging architecture
  
  Revision  Changes    Path
  1.99      +7 -2      jakarta-avalon/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/build.xml,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- build.xml	2001/10/30 20:18:56	1.98
  +++ build.xml	2001/10/31 15:45:50	1.99
  @@ -126,6 +126,9 @@
   
     <!-- Set up dist properties -->
     <target name="setup-properties" >
  +    <available property="log4j.present" classname="org.apache.log4j.Category">
  +      <classpath refid="project.class.path"/>
  +    </available>
   
       <property name="dist.dir" value="dist"/>
       <property name="dist.bin" value="${dist.dir}/bin"/>
  @@ -160,6 +163,8 @@
              deprecation="${deprecation}">
         <classpath refid="project.class.path" />
         <src path="${test.dir}"/>
  +      <exclude name="org/apache/avalon/framework/logger/Log4JLogger.java"
  +               unless="log4j.present"/>
       </javac>
     </target>
   
  @@ -397,9 +402,9 @@
         </fileset>
       </copy>
   
  -    <style style="${announce2txt}" in="${build.context}/xdocs/framework/announcement.xml"

  +    <style style="${announce2txt}" in="${build.context}/xdocs/framework/announcement.xml"
              out="Announcement.txt"/>
  -    <style style="${announce2header}" in="${build.context}/xdocs/framework/announcement.xml"

  +    <style style="${announce2header}" in="${build.context}/xdocs/framework/announcement.xml"
              out="${dist.base}/HEADER.html"/>
       <style style="${announce2readme}" in="${build.context}/xdocs/framework/announcement.xml"
              out="${dist.base}/README.html"/>
  
  
  
  1.3       +10 -4     jakarta-avalon/src/java/org/apache/avalon/framework/logger/AbstractLoggable.java
  
  Index: AbstractLoggable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/logger/AbstractLoggable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractLoggable.java	2001/05/13 06:37:24	1.2
  +++ AbstractLoggable.java	2001/10/31 15:45:50	1.3
  @@ -7,8 +7,6 @@
    */
   package org.apache.avalon.framework.logger;
   
  -import org.apache.log.Logger;
  -
   /**
    * Utility class to allow construction of easy components that will perform logging.
    *
  @@ -31,6 +29,14 @@
       }
   
       /**
  +     * Set the component's logger.
  +     */
  +    public void setLogger( final org.apache.log.Logger logger )
  +    {
  +        setLogger( new LogKitLogger(logger) );
  +    }
  +
  +    /**
        * Helper method to allow sub-classes to aquire logger.
        *
        * @return the Logger
  @@ -60,12 +66,12 @@
       protected void setupLogger( final Object component, final String subCategory )
       {
           Logger logger = m_logger;
  -        
  +
           if( null != subCategory )
           {
               logger = m_logger.getChildLogger( subCategory );
           }
  -        
  +
           setupLogger( component, logger );
       }
   
  
  
  
  1.3       +9 -2      jakarta-avalon/src/java/org/apache/avalon/framework/logger/Loggable.java
  
  Index: Loggable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/logger/Loggable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Loggable.java	2001/05/13 06:37:24	1.2
  +++ Loggable.java	2001/10/31 15:45:50	1.3
  @@ -7,16 +7,23 @@
    */
   package org.apache.avalon.framework.logger;
   
  -import org.apache.log.Logger;
  -
   /**
    * Components that need to log can implement this interface to
    * be provided Loggers.
    *
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    */
   public interface Loggable
   {
  +    /**
  +     * Provide component with a logger.
  +     *
  +     * @param logger the logger
  +     * @deprecated Use the setLogger( Logger ) method instead.
  +     */
  +    void setLogger( org.apache.log.Logger logger );
  +
       /**
        * Provide component with a logger.
        *
  
  
  
  1.1                  jakarta-avalon/src/java/org/apache/avalon/framework/logger/Log4JLogger.java
  
  Index: Log4JLogger.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.framework.logger;
  
  import org.apache.log4j.Category;
  import org.apache.log4j.Priority;
  
  /**
   * The default LogKit wrapper class for Logger.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   */
  public final class Log4JLogger implements Logger
  {
      private final Category m_logger;
  
      public Log4JLogger( Category logImpl )
      {
          m_logger = logImpl;
      }
  
      public final void debug( final String message )
      {
          m_logger.debug(message);
      }
  
      public final void debug( final String message, final Throwable throwable )
      {
          m_logger.debug( message, throwable );
      }
  
      public final boolean isDebugEnabled()
      {
          return m_logger.isDebugEnabled();
      }
  
      public final void info( final String message )
      {
          m_logger.info( message );
      }
  
      public final void info( final String message, final Throwable throwable )
      {
          m_logger.info( message, throwable );
      }
  
      public final boolean isInfoEnabled()
      {
          return m_logger.isInfoEnabled();
      }
  
      public final void warn( final String message )
      {
          m_logger.warn( message );
      }
  
      public final void warn( final String message, final Throwable throwable )
      {
          m_logger.warn( message, throwable );
      }
  
      public final boolean isWarnEnabled()
      {
          return m_logger.isEnabledFor( Priority.WARN );
      }
  
      public final void error( final String message )
      {
          m_logger.error( message );
      }
  
      public final void error( final String message, final Throwable throwable )
      {
          m_logger.error( message, throwable );
      }
  
      public final boolean isErrorEnabled()
      {
          return m_logger.isEnabledFor( Priority.ERROR );
      }
  
      public final void fatalError( final String message )
      {
          m_logger.fatal( message );
      }
  
      public final void fatalError( final String message, final Throwable throwable )
      {
          m_logger.fatal( message, throwable );
      }
  
      public final boolean isFatalErrorEnabled()
      {
          return m_logger.isEnabledFor( Priority.FATAL );
      }
  
      public final Logger getChildLogger( final String name )
      {
          return new Log4JLogger( Category.getInstance( m_logger.getName() + "." + name )
);
      }
  }
  
  
  1.1                  jakarta-avalon/src/java/org/apache/avalon/framework/logger/LogKitLogger.java
  
  Index: LogKitLogger.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.framework.logger;
  
  /**
   * The default LogKit wrapper class for Logger.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   */
  public final class LogKitLogger implements Logger
  {
      private final org.apache.log.Logger m_logger;
  
      public LogKitLogger( org.apache.log.Logger logImpl )
      {
          m_logger = logImpl;
      }
  
      public final void debug( final String message )
      {
          m_logger.debug(message);
      }
  
      public final void debug( final String message, final Throwable throwable )
      {
          m_logger.debug( message, throwable );
      }
  
      public final boolean isDebugEnabled()
      {
          return m_logger.isDebugEnabled();
      }
  
      public final void info( final String message )
      {
          m_logger.info( message );
      }
  
      public final void info( final String message, final Throwable throwable )
      {
          m_logger.info( message, throwable );
      }
  
      public final boolean isInfoEnabled()
      {
          return m_logger.isInfoEnabled();
      }
  
      public final void warn( final String message )
      {
          m_logger.warn( message );
      }
  
      public final void warn( final String message, final Throwable throwable )
      {
          m_logger.warn( message, throwable );
      }
  
      public final boolean isWarnEnabled()
      {
          return m_logger.isWarnEnabled();
      }
  
      public final void error( final String message )
      {
          m_logger.error( message );
      }
  
      public final void error( final String message, final Throwable throwable )
      {
          m_logger.error( message, throwable );
      }
  
      public final boolean isErrorEnabled()
      {
          return m_logger.isErrorEnabled();
      }
  
      public final void fatalError( final String message )
      {
          m_logger.fatalError( message );
      }
  
      public final void fatalError( final String message, final Throwable throwable )
      {
          m_logger.fatalError( message, throwable );
      }
  
      public final boolean isFatalErrorEnabled()
      {
          return m_logger.isFatalErrorEnabled();
      }
  
      public final Logger getChildLogger( final String name )
      {
          return new LogKitLogger( m_logger.getChildLogger( name ) );
      }
  }
  
  
  1.1                  jakarta-avalon/src/java/org/apache/avalon/framework/logger/Logger.java
  
  Index: Logger.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.framework.logger;
  
  /**
   * Facade for loggers.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface Logger
  {
      void debug( String message );
      void debug( String message, Throwable throwable );
      boolean isDebugEnabled();
  
      void info( String message );
      void info( String message, Throwable throwable );
      boolean isInfoEnabled();
  
      void warn( String message );
      void warn( String message, Throwable throwable );
      boolean isWarnEnabled();
  
      void error( String message );
      void error( String message, Throwable throwable );
      boolean isErrorEnabled();
  
      void fatalError( String message );
      void fatalError( String message, Throwable throwable );
      boolean isFatalErrorEnabled();
  
      Logger getChildLogger( String name );
  }
  
  
  

--
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