You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2005/02/25 14:42:42 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j AppenderSkeleton.java Appender.java

ceki        2005/02/25 05:42:42

  Modified:    src/java/org/apache/log4j AppenderSkeleton.java
                        Appender.java
  Log:
  We already have a strategy ensuring backward compatibility, no need to make things even more complicated.
  
  Revision  Changes    Path
  1.39      +13 -33    logging-log4j/src/java/org/apache/log4j/AppenderSkeleton.java
  
  Index: AppenderSkeleton.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/AppenderSkeleton.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- AppenderSkeleton.java	24 Feb 2005 22:56:20 -0000	1.38
  +++ AppenderSkeleton.java	25 Feb 2005 13:42:42 -0000	1.39
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999,2004 The Apache Software Foundation.
  - *
  + * 
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - *
  + * 
    *      http://www.apache.org/licenses/LICENSE-2.0
  - *
  + * 
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -32,7 +32,7 @@
    * @since 0.8.1
    */
   public abstract class AppenderSkeleton extends ComponentBase implements Appender, OptionHandler {
  -
  +  
     /**
      * The layout variable does not need to be set if the appender
      * implementation has its own layout.
  @@ -70,46 +70,26 @@
     protected boolean closed = false;
   
     /**
  -   * Is the appender properly configured and ready to process
  -   * events.
  +   * By default, an appender is not in working order. It must be configured 
  +   * first. 
      */
  -  protected boolean active = true;
  -
  +  protected boolean active = false;
  +  
     /**
      * The guard prevents an appender from repeatedly calling its own doAppend
      * method.
      */
     private boolean guard = false;
  -
  -
  -  /**
  -   *  Constructs an AppenderSkeleton.
  -   *  @remarks This constructor marks that the appender is ready for use
  -   *   when construction is complete.  If not, call super(false).
  -   */
  -  protected AppenderSkeleton() {
  -     active = true;
  -  }
     
     /**
  -   *  Constructs an AppenderSkeleton.
  -   *  @param isActive true if the appender is ready to process events
  -   *    when fully constructed.
  -   */
  -  protected AppenderSkeleton(final boolean isActive) {
  -     active = isActive;
  -  }
  -
  -
  -  /**
      * Calls the {@link #activate} method.
  -   *
  +   * 
      * @deprecated Please call the activate() method instead.
      */
     public void activateOptions() {
       activate();
     }
  -
  +  
     /**
      * Default implementation called by sub-classes.
      */
  @@ -235,7 +215,7 @@
     public synchronized void doAppend(LoggingEvent event) {
       // WARNING: The guard check MUST be the first statement in the
       // doAppend() method.
  -
  +    
       // prevent re-entry.
       if (guard) {
         return;
  @@ -262,7 +242,7 @@
   
         Filter f = this.headFilter;
   
  -FILTER_LOOP:
  +FILTER_LOOP: 
         while (f != null) {
           switch (f.decide(event)) {
           case Filter.DENY:
  @@ -318,7 +298,7 @@
     /**
      * Set the threshold level. All log events with lower level than the
      * threshold level are ignored by the appender.
  -   *
  +   * 
      * <p>
      * In configuration files this option is specified by setting the value of
      * the <b>Threshold</b> option to a level string, such as "DEBUG", "INFO"
  
  
  
  1.19      +22 -0     logging-log4j/src/java/org/apache/log4j/Appender.java
  
  Index: Appender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Appender.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Appender.java	22 Feb 2005 20:25:32 -0000	1.18
  +++ Appender.java	25 Feb 2005 13:42:42 -0000	1.19
  @@ -29,6 +29,12 @@
    * @author Ceki G&uuml;lc&uuml;
    */
   public interface Appender extends Component {
  +  
  +  /**
  +   * An appender must be activated before it can be used.
  +   */
  +  public void activate();
  +  
     /**
      * Add a filter to the end of the filter list.
      *
  @@ -65,6 +71,22 @@
      */
     public void close();
   
  +  
  +  /**
  +   * Is this appender closed?
  +   *
  +   * @since 1.3
  +   */
  +  public boolean isClosed();
  +
  +  /**
  +   * Is this appender in working order?
  +   *
  +   * @since 1.3
  +   */
  +  public boolean isActive();
  +  
  +  
     /**
      * Log in <code>Appender</code> specific way. When appropriate, Loggers will
      * call the <code>doAppend</code> method of appender implementations in
  
  
  

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