logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j Layout.java Logger.java
Date Tue, 04 Jan 2005 15:09:55 GMT
ceki        2005/01/04 07:09:55

  Modified:    src/java/org/apache/log4j/spi Filter.java ComponentBase.java
               src/java/org/apache/log4j Layout.java Logger.java
  Log:
  Layout, Filter extend ComponentBase
  
  Revision  Changes    Path
  1.9       +1 -16     logging-log4j/src/java/org/apache/log4j/spi/Filter.java
  
  Index: Filter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/Filter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Filter.java	24 Nov 2004 08:17:01 -0000	1.8
  +++ Filter.java	4 Jan 2005 15:09:54 -0000	1.9
  @@ -60,7 +60,7 @@
   
      @author Ceki Gülcü
      @since 0.9.0 */
  -public abstract class Filter implements OptionHandler {
  +public abstract class Filter extends ComponentBase implements OptionHandler {
     /**
        The log event must be dropped immediately without consulting
        with the remaining filters, if any, in the chain.  */
  @@ -113,19 +113,4 @@
     public Filter getNext() {
           return next;
     }
  -  
  -  /**
  -   * Return an instance specific logger to be used by the Filter itself.
  -   * This logger is not intended to be used by Mrs. Piggy, our proverbial user,
  -   * hence the protected keyword.
  -   * 
  -   * @return instance specific logger
  -   */
  -//  protected Logger getLogger() {
  -//    if(logger == null) {
  -//      logger = LogManager.getLogger(this.getClass().getName());
  -//    }
  -//    return logger;
  -//  }
  -  
   }
  
  
  
  1.2       +10 -7     logging-log4j/src/java/org/apache/log4j/spi/ComponentBase.java
  
  Index: ComponentBase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/ComponentBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComponentBase.java	3 Jan 2005 17:35:26 -0000	1.1
  +++ ComponentBase.java	4 Jan 2005 15:09:54 -0000	1.2
  @@ -35,10 +35,10 @@
     
     /**
      * Return an instance specific logger to be used by the component itself.
  -   * This logger is not intended to be used by Mrs. Piggy, our proverbial user,
  -   * hence the protected keyword.
  +   * This logger is not intended to be accessed by the end-user, hence the 
  +   * protected keyword.
      * 
  -   * <p>In case the repository for this components is not correctly set,
  +   * <p>In case the repository for this components is not set,
      * this implementations returns a {@link SimpleLogger} instance.
      * 
      * @return A ULogger instance.
  @@ -50,10 +50,13 @@
         } else {
           logger = LogManager.SIMPLE_LOGGER_FA.getLogger(this.getClass().getName());
         }
  +    } else if(repository != null && !(logger instanceof org.apache.log4j.Logger)){
  +      // if repository is set but logger is not an instance of Logger, we
  +      // could reset the logger, as in the line below. However, we chose not to
  +      // do so in order to make the bigger problem more apparent.
  +      
  +      // logger = repository.getLogger(this.getClass().getName());
       }
       return logger;
  -  }
  -  
  -  
  -  
  +  } 
   }
  
  
  
  1.14      +4 -38     logging-log4j/src/java/org/apache/log4j/Layout.java
  
  Index: Layout.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Layout.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Layout.java	28 Dec 2004 23:08:12 -0000	1.13
  +++ Layout.java	4 Jan 2005 15:09:54 -0000	1.14
  @@ -20,7 +20,7 @@
   import java.io.IOException;
   import java.io.Writer;
   
  -import org.apache.log4j.spi.LoggerRepository;
  +import org.apache.log4j.spi.ComponentBase;
   import org.apache.log4j.spi.LoggingEvent;
   import org.apache.log4j.spi.OptionHandler;
   
  @@ -32,13 +32,13 @@
      @author Chris Nokes
   
   */
  -public abstract class Layout implements OptionHandler {
  +public abstract class Layout extends ComponentBase implements OptionHandler {
     // Note that the line.separator property can be looked up even by
     // applets.
     public static final String LINE_SEP = System.getProperty("line.separator");
     public static final int LINE_SEP_LEN = LINE_SEP.length();
     
  -  final static Logger logger = Logger.getLogger(Layout.class); 
  +  
     
     
     public CharArrayWriter charArrayWriter = new CharArrayWriter(1024);
  @@ -46,9 +46,6 @@
     String header;
     String footer;
   
  -  LoggerRepository repository;
  -  // Most layouts ignore the throwable. If a subclasses needs to override the 
  -  // default value it should do so in its default constructor.
     protected boolean ignoresThrowable = true;
     
     /**
  @@ -60,7 +57,7 @@
     	  format(charArrayWriter, event);
   	  } catch(IOException ie) {
   	  	// There cannot be an IoException while writing to a CharArrayWriter
  -	  	logger.error("Unexpected IOException while writing to CharArrayWriter", ie);
  +	  	getLogger().error("Unexpected IOException while writing to CharArrayWriter", ie);
   	  }
     	return charArrayWriter.toString();
     }
  @@ -141,35 +138,4 @@
       this.header = header;
     }
     
  -  /**
  -   * Repository where this layout is attached. If not set, the
  -   * returned valyue may be null.
  -   * 
  -   * @return The repository where this layout is attached.
  -   */
  -  public LoggerRepository getLoggerRepository() {
  -    return repository;
  -  }
  -    
  -  /**
  -   * Set the LoggerRepository this layout is attached to indirectly through its 
  -   * containing appener. This operation can only be performed once. Once set, 
  -   * the repository cannot be changed.
  -   *   
  -   * @param repository The repository where this layout is indirectly attached.
  -   * @throws IllegalStateException If you try to change the repository after it
  -   * has been set.
  -   * 
  -   * @since 1.3
  -   */
  -  public void setLoggerRepository(LoggerRepository repository) throws IllegalStateException
{
  -    if(repository == null) {
  -      throw new IllegalArgumentException("repository argument cannot be null");
  -    }
  -    if(this.repository == null) {
  -      this.repository = repository;
  -    } else {
  -      throw new IllegalStateException("Repository has been already set");
  -    }
  -  }
   }
  
  
  
  1.29      +1 -2      logging-log4j/src/java/org/apache/log4j/Logger.java
  
  Index: Logger.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Logger.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Logger.java	3 Jan 2005 11:05:45 -0000	1.28
  +++ Logger.java	4 Jan 2005 15:09:54 -0000	1.29
  @@ -17,7 +17,6 @@
   package org.apache.log4j;
   
   import org.apache.log4j.spi.LoggerFactory;
  -import org.apache.ugli.ULogger;
   import org.apache.ugli.impl.MessageFormatter;
   
   
  @@ -29,7 +28,7 @@
    * @author Ceki G&uuml;lc&uuml;
    * @since log4j 1.2
   */
  -public class Logger extends Category implements ULogger {
  +public class Logger extends Category {
     /**
      * The fully qualified name of the Logger class. See also the {@link #getFQCN}
      * method.
  
  
  

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


Mime
View raw message