ceki        2004/05/19 06:15:44

  Modified:    src/java/org/apache/log4j/chainsaw ThresholdSlider.java
                        LogUI.java
               src/java/org/apache/log4j/config PropertySetter.java
                        PropertyGetter.java
               src/java/org/apache/log4j/jmx AppenderDynamicMBean.java
                        LayoutDynamicMBean.java
               src/java/org/apache/log4j/net SocketServer.java
               src/java/org/apache/log4j Priority.java Level.java
                        AppenderSkeleton.java Category.java
               src/java/org/apache/log4j/xml DOMConfigurator.java
               src/java/org/apache/log4j/varia LevelMatchFilter.java
  Log:
  - Inversed the order of inheritance. Priority now inherits from Level 

  and not the other way around.

  

  - Added various methods in Category to ensure backward compatibilty.
  
  Revision  Changes    Path
  1.6       +5 -6      
logging-log4j/src/java/org/apache/log4j/chainsaw/ThresholdSlider.java
  
  Index: ThresholdSlider.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ThresholdSlider.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ThresholdSlider.java      28 Mar 2004 10:04:30 -0000      1.5
  +++ ThresholdSlider.java      19 May 2004 13:15:41 -0000      1.6
  @@ -17,7 +17,6 @@
   package org.apache.log4j.chainsaw;
   
   import org.apache.log4j.Level;
  -import org.apache.log4j.Priority;
   
   import java.util.Arrays;
   import java.util.Collections;
  @@ -42,20 +41,20 @@
     final List priorityList;
   
     ThresholdSlider() {
  -    Priority[] priorities =
  +    Level[] levels =
         new Level[] {
           Level.OFF, Level.FATAL, Level.ERROR, Level.WARN, Level.INFO,
           Level.DEBUG, Level.ALL
         };
   
  -    priorityList = Arrays.asList(priorities);
  +    priorityList = Arrays.asList(levels);
   
       Collections.sort(
         priorityList,
         new Comparator() {
           public int compare(Object o1, Object o2) {
  -          Priority p1 = (Priority) o1;
  -          Priority p2 = (Priority) o2;
  +          Level p1 = (Level) o1;
  +          Level p2 = (Level) o2;
   
             if (p1.toInt() == p2.toInt()) {
               return 0;
  @@ -74,7 +73,7 @@
       Hashtable labelMap = new Hashtable();
   
       for (Iterator iter = priorityList.iterator(); iter.hasNext();) {
  -      Priority item = (Priority) iter.next();
  +      Level item = (Level) iter.next();
         labelMap.put(
           new Integer(priorityList.indexOf(item)), new JLabel(item.toString()));
   
  
  
  
  1.96      +3 -4      logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- LogUI.java        17 May 2004 06:17:59 -0000      1.95
  +++ LogUI.java        19 May 2004 13:15:41 -0000      1.96
  @@ -19,7 +19,6 @@
   import org.apache.log4j.AppenderSkeleton;
   import org.apache.log4j.Level;
   import org.apache.log4j.LogManager;
  -import org.apache.log4j.Priority;
   import org.apache.log4j.chainsaw.help.HelpManager;
   import org.apache.log4j.chainsaw.help.Tutorial;
   import org.apache.log4j.chainsaw.helper.SwingHelper;
  @@ -561,12 +560,12 @@
       //List utilList = UtilLoggingLevel.getAllPossibleLevels();
       // TODO: Replace the array list creating with the standard way of
       // retreiving the Level set. (TBD)
  -    Priority[] priorities =
  +    Level[] levels =
         new Level[] { Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG };
       List priorityLevels = new ArrayList();
   
  -    for (int i = 0; i < priorities.length; i++) {
  -      priorityLevels.add(priorities[i].toString());
  +    for (int i = 0; i < levels.length; i++) {
  +      priorityLevels.add(levels[i].toString());
       }
   
       List utilLevels = new ArrayList();
  
  
  
  1.22      +1 -1      
logging-log4j/src/java/org/apache/log4j/config/PropertySetter.java
  
  Index: PropertySetter.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/config/PropertySetter.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- PropertySetter.java       27 Feb 2004 16:47:31 -0000      1.21
  +++ PropertySetter.java       19 May 2004 13:15:42 -0000      1.22
  @@ -371,7 +371,7 @@
         } else if ("false".equalsIgnoreCase(v)) {
           return Boolean.FALSE;
         }
  -    } else if (Priority.class.isAssignableFrom(type)) {
  +    } else if (Level.class.isAssignableFrom(type)) {
         return OptionConverter.toLevel(v, (Level) Level.DEBUG);
       }
   
  
  
  
  1.8       +3 -2      
logging-log4j/src/java/org/apache/log4j/config/PropertyGetter.java
  
  Index: PropertyGetter.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/config/PropertyGetter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PropertyGetter.java       20 May 2002 09:52:57 -0000      1.7
  +++ PropertyGetter.java       19 May 2004 13:15:42 -0000      1.8
  @@ -10,7 +10,8 @@
   
   import java.beans.*;
   import java.lang.reflect.*;
  -import org.apache.log4j.Priority;
  +
  +import org.apache.log4j.Level;
   import org.apache.log4j.helpers.LogLog;
   
   
  @@ -80,6 +81,6 @@
         Integer.TYPE.isAssignableFrom(type) ||
         Long.TYPE.isAssignableFrom(type)    ||
         Boolean.TYPE.isAssignableFrom(type) ||
  -      Priority.class.isAssignableFrom(type);
  +      Level.class.isAssignableFrom(type);
     }
   }
  
  
  
  1.4       +3 -3      
logging-log4j/src/java/org/apache/log4j/jmx/AppenderDynamicMBean.java
  
  Index: AppenderDynamicMBean.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/jmx/AppenderDynamicMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AppenderDynamicMBean.java 24 Apr 2002 01:16:13 -0000      1.3
  +++ AppenderDynamicMBean.java 19 May 2004 13:15:42 -0000      1.4
  @@ -79,7 +79,7 @@
        Class returnClass = readMethod.getReturnType();
        if(isSupportedType(returnClass)) {
          String returnClassName;
  -       if(returnClass.isAssignableFrom(Priority.class)) {
  +       if(returnClass.isAssignableFrom(Level.class)) {
            returnClassName = "java.lang.String";
          } else {
            returnClassName = returnClass.getName();
  @@ -126,7 +126,7 @@
       }
   
   
  -    if(clazz.isAssignableFrom(Priority.class)) {
  +    if(clazz.isAssignableFrom(Level.class)) {
         return true;
       }
   
  @@ -276,7 +276,7 @@
         Object[] o = new Object[1];
   
         Class[] params = mu.writeMethod.getParameterTypes();
  -      if(params[0] == org.apache.log4j.Priority.class) {
  +      if(params[0] == org.apache.log4j.Level.class) {
        value = OptionConverter.toLevel((String) value,
                                        (Level) getAttribute(name));
         }
  
  
  
  1.4       +1 -1      
logging-log4j/src/java/org/apache/log4j/jmx/LayoutDynamicMBean.java
  
  Index: LayoutDynamicMBean.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/jmx/LayoutDynamicMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LayoutDynamicMBean.java   24 Apr 2002 01:16:13 -0000      1.3
  +++ LayoutDynamicMBean.java   19 May 2004 13:15:42 -0000      1.4
  @@ -223,7 +223,7 @@
         Object[] o = new Object[1];
   
         Class[] params = mu.writeMethod.getParameterTypes();
  -      if(params[0] == org.apache.log4j.Priority.class) {
  +      if(params[0] == org.apache.log4j.Level.class) {
        value = OptionConverter.toLevel((String) value,
                                        (Level) getAttribute(name));
         }
  
  
  
  1.12      +2 -2      logging-log4j/src/java/org/apache/log4j/net/SocketServer.java
  
  Index: SocketServer.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/SocketServer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SocketServer.java 15 May 2004 18:22:57 -0000      1.11
  +++ SocketServer.java 19 May 2004 13:15:42 -0000      1.12
  @@ -167,7 +167,7 @@
   
         File configFile = new File(dir, key+CONFIG_FILE_EXT);
         if(configFile.exists()) {
  -     Hierarchy h = new Hierarchy(new RootLogger((Level) Priority.DEBUG));
  +     Hierarchy h = new Hierarchy(new RootLogger(Level.DEBUG));
        hierarchyMap.put(inetAddress, h);
   
        new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);
  @@ -184,7 +184,7 @@
       if(genericHierarchy == null) {
         File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
         if(f.exists()) {
  -     genericHierarchy = new Hierarchy(new RootLogger((Level) Priority.DEBUG));
  +     genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
        new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
         } else {
        cat.warn("Could not find config file ["+f+
  
  
  
  1.27      +30 -109   logging-log4j/src/java/org/apache/log4j/Priority.java
  
  Index: Priority.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Priority.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Priority.java     27 Feb 2004 16:47:28 -0000      1.26
  +++ Priority.java     19 May 2004 13:15:42 -0000      1.27
  @@ -20,127 +20,48 @@
   
   
   /**
  -   <font color="#AA4444">Refrain from using this class directly, use
  -   the [EMAIL PROTECTED] Level} class instead</font>.
  -
  -   @author Ceki G&uuml;lc&uuml; */
  -public class Priority {
  -  public static final int OFF_INT = Integer.MAX_VALUE;
  -  public static final int FATAL_INT = 50000;
  -  public static final int ERROR_INT = 40000;
  -  public static final int WARN_INT = 30000;
  -  public static final int INFO_INT = 20000;
  -  public static final int DEBUG_INT = 10000;
  -
  -  //public final static int FINE_INT = DEBUG_INT;
  -  public static final int ALL_INT = Integer.MIN_VALUE;
  + * <font color="#AA4444">Refrain from using this class directly, use the 
  + * [EMAIL PROTECTED] Level} class instead</font>. 
  + * 
  + * 
  + * @author Ceki G&uuml;lc&uuml; 
  + * @deprecated 
  + */
  +public class Priority extends Level {
  +  
  +  protected Priority(int level, String levelStr, int syslogEquivalent) {
  +    super(level, levelStr, syslogEquivalent);
  +  }
   
  +  
     /**
        The <code>FATAL</code> level designates very severe error
        events that will presumably lead the application to abort.
      */
  -  public static final Priority FATAL = new Level(FATAL_INT, "FATAL", 0);
  +  //public static final Priority FATAL = new Level(FATAL_INT, "FATAL", 0);
   
     /**
        The <code>ERROR</code> level designates error events that
        might still allow the application to continue running.  */
  -  public static final Priority ERROR = new Level(ERROR_INT, "ERROR", 3);
  + // public static final Priority ERROR = new Level(ERROR_INT, "ERROR", 3);
   
     /**
        The <code>WARN</code> level designates potentially harmful situations.
     */
  -  public static final Priority WARN = new Level(WARN_INT, "WARN", 4);
  + // public static final Priority WARN = new Level(WARN_INT, "WARN", 4);
   
     /**
        The <code>INFO</code> level designates informational messages
        that highlight the progress of the application at coarse-grained
        level.  */
  -  public static final Priority INFO = new Level(INFO_INT, "INFO", 6);
  + // public static final Priority INFO = new Level(INFO_INT, "INFO", 6);
   
     /**
        The <code>DEBUG</code> priority designates fine-grained
        informational events that are most useful to debug an
        application.  */
  -  public static final Priority DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
  -  int level;
  -  String levelStr;
  -  int syslogEquivalent;
  -
  -  /**
  -     Instantiate a level object.
  -   */
  -  protected Priority(int level, String levelStr, int syslogEquivalent) {
  -    this.level = level;
  -    this.levelStr = levelStr;
  -    this.syslogEquivalent = syslogEquivalent;
  -  }
  -
  -  /**
  -   * Two priorities are equal if their level fields are equal.
  -   * @since 1.2
  -   */
  -  public boolean equals(Object o) {
  -    if (o instanceof Priority) {
  -      Priority r = (Priority) o;
  -
  -      return (this.level == r.level);
  -    } else {
  -      return false;
  -    }
  -  }
  +  //public static final Priority DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
   
  -  /**
  -   * The hashCode        of a Level (i.e. Priority) is its level field.
  -   */
  -  public int hashCode() {
  -    return level;
  -  }
  -
  -  /**
  -     Return the syslog equivalent of this priority as an integer.
  -   */
  -  public final int getSyslogEquivalent() {
  -    return syslogEquivalent;
  -  }
  -
  -  /**
  -     Returns <code>true</code> if this level has a higher or equal
  -     level than the level passed as argument, <code>false</code>
  -     otherwise.
  -
  -     <p>You should think twice before overriding the default
  -     implementation of <code>isGreaterOrEqual</code> method.
  -
  -  */
  -  public boolean isGreaterOrEqual(Priority r) {
  -    return level >= r.level;
  -  }
  -
  -  /**
  -     Return all possible priorities as an array of Level objects in
  -     descending order.
  -
  -     @deprecated This method will be removed with no replacement.
  -  */
  -  public static Priority[] getAllPossiblePriorities() {
  -    return new Priority[] {
  -      Priority.FATAL, Priority.ERROR, Level.WARN, Priority.INFO, Priority.DEBUG
  -    };
  -  }
  -
  -  /**
  -     Returns the string representation of this priority.
  -   */
  -  public final String toString() {
  -    return levelStr;
  -  }
  -
  -  /**
  -     Returns the integer representation of this level.
  -   */
  -  public final int toInt() {
  -    return level;
  -  }
   
     /**
        Convert the string passed as argument to a priority. If the
  @@ -150,33 +71,33 @@
   
   
     */
  -  public static Priority toPriority(String sArg) {
  -    return Level.toLevel(sArg);
  -  }
  +//  public static Level toPriority(String sArg) {
  +//    return Level.toLevel(sArg);
  +//  }
   
     /**
       Convert an integer passed as argument to a priority. If the
       conversion fails, then this method returns [EMAIL PROTECTED] #DEBUG}.
   
     */
  -  public static Priority toPriority(int val) {
  -    return toPriority(val, Priority.DEBUG);
  -  }
  +//  public static Priority toPriority(int val) {
  +//    return toPriority(val, Priority.DEBUG);
  +//  }
   
     /**
       Convert an integer passed as argument to a priority. If the
       conversion fails, then this method returns the specified default.
     */
  -  public static Priority toPriority(int val, Priority defaultPriority) {
  -    return Level.toLevel(val, (Level) defaultPriority);
  -  }
  +//  public static Priority toPriority(int val, Priority defaultPriority) {
  +//    return Level.toLevel(val, (Level) defaultPriority);
  +//  }
   
     /**
        Convert the string passed as argument to a priority. If the
        conversion fails, then this method returns the value of
        <code>defaultPriority</code>.
     */
  -  public static Priority toPriority(String sArg, Priority defaultPriority) {
  -    return Level.toLevel(sArg, (Level) defaultPriority);
  -  }
  +//  public static Priority toPriority(String sArg, Priority defaultPriority) {
  +//    return Level.toLevel(sArg, (Level) defaultPriority);
  +//  }
   }
  
  
  
  1.12      +88 -4     logging-log4j/src/java/org/apache/log4j/Level.java
  
  Index: Level.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Level.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Level.java        27 Feb 2004 16:47:28 -0000      1.11
  +++ Level.java        19 May 2004 13:15:42 -0000      1.12
  @@ -32,7 +32,17 @@
      @author Ceki G&uuml;lc&uuml;
   
    */
  -public class Level extends Priority {
  +public class Level {
  +  public static final int OFF_INT = Integer.MAX_VALUE;
  +  public static final int FATAL_INT = 50000;
  +  public static final int ERROR_INT = 40000;
  +  public static final int WARN_INT = 30000;
  +  public static final int INFO_INT = 20000;
  +  public static final int DEBUG_INT = 10000;
  +
  +  //public final static int FINE_INT = DEBUG_INT;
  +  public static final int ALL_INT = Integer.MIN_VALUE;
  +  
     /**
        The <code>OFF</code> has the highest possible rank and is
        intended to turn off logging.  */
  @@ -71,11 +81,18 @@
        turn on all logging.  */
     public static final Level ALL = new Level(ALL_INT, "ALL", 7);
   
  +  
  +  int level;
  +  String levelStr;
  +  int syslogEquivalent;
  +
     /**
  -     Instantiate a Level object.
  -   */
  +    Instantiate a level object.
  +  */ 
     protected Level(int level, String levelStr, int syslogEquivalent) {
  -    super(level, levelStr, syslogEquivalent);
  +   this.level = level;
  +   this.levelStr = levelStr;
  +   this.syslogEquivalent = syslogEquivalent;
     }
   
     /**
  @@ -94,7 +111,74 @@
     public static Level toLevel(int val) {
       return toLevel(val, Level.DEBUG);
     }
  +  /**
  +   * Two priorities are equal if their level fields are equal.
  +   * @since 1.2
  +   */
  +  public boolean equals(Object o) {
  +    if (o instanceof Level) {
  +      Level r = (Level) o;
  +
  +      return (this.level == r.level);
  +    } else {
  +      return false;
  +    }
  +  }
  +
  +  /**
  +   * The hashCode        of a Level (i.e. Priority) is its level field.
  +   */
  +  public int hashCode() {
  +    return level;
  +  }
  +
  +  /**
  +     Return the syslog equivalent of this priority as an integer.
  +   */
  +  public final int getSyslogEquivalent() {
  +    return syslogEquivalent;
  +  }
  +
  +  /**
  +     Returns <code>true</code> if this level has a higher or equal
  +     level than the level passed as argument, <code>false</code>
  +     otherwise.
  +
  +     <p>You should think twice before overriding the default
  +     implementation of <code>isGreaterOrEqual</code> method.
  +
  +  */
  +  public boolean isGreaterOrEqual(Level r) {
  +    return level >= r.level;
  +  }
  +
  +  /**
  +  Return all possible priorities as an array of Level objects in
  +  descending order.
  +
  +  @deprecated This method will be removed with no replacement.
  +*/
  +  public static Level[] getAllPossiblePriorities() {
  +    return new Level[] {
  +     Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG
  + };
  +}
  +
   
  +  /**
  +  Returns the string representation of this priority.
  +  */
  +  public final String toString() {
  +    return levelStr;
  +  }
  +
  +  /**
  +    Returns the integer representation of this level.
  +  */
  +  public final int toInt() {
  +    return level;
  +  }
  +  
     /**
       Convert an integer passed as argument to a level. If the
       conversion fails, then this method returns the specified default.
  
  
  
  1.26      +5 -5      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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AppenderSkeleton.java     27 Feb 2004 16:47:28 -0000      1.25
  +++ AppenderSkeleton.java     19 May 2004 13:15:42 -0000      1.26
  @@ -49,7 +49,7 @@
     /**
      * There is no level threshold filtering by default.
      */
  -  protected Priority threshold;
  +  protected Level threshold;
   
     /**
      * It is assumed and enforced that errorHandler is never null.
  @@ -181,7 +181,7 @@
      *
      * @since 1.1
      */
  -  public Priority getThreshold() {
  +  public Level getThreshold() {
       return threshold;
     }
   
  @@ -190,8 +190,8 @@
      * there is no threshold set, then the return value is always
      * <code>true</code>.
      */
  -  public boolean isAsSevereAsThreshold(Priority priority) {
  -    return ((threshold == null) || priority.isGreaterOrEqual(threshold));
  +  public boolean isAsSevereAsThreshold(Level level) {
  +    return ((threshold == null) || level.isGreaterOrEqual(threshold));
     }
   
     /**
  @@ -284,7 +284,7 @@
      *
      * @since 0.8.3
      */
  -  public void setThreshold(Priority threshold) {
  +  public void setThreshold(Level threshold) {
       this.threshold = threshold;
     }
   }
  
  
  
  1.82      +36 -3     logging-log4j/src/java/org/apache/log4j/Category.java
  
  Index: Category.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Category.java,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- Category.java     15 May 2004 18:22:56 -0000      1.81
  +++ Category.java     19 May 2004 13:15:42 -0000      1.82
  @@ -501,7 +501,7 @@
     /**
      * @deprecated Please use the the [EMAIL PROTECTED] #getEffectiveLevel} method 
instead.
      */
  -  public Priority getChainedPriority() {
  +  public Level getChainedPriority() {
       for (Category c = this; c != null; c = c.parent) {
         if (c.level != null) {
           return c.level;
  @@ -830,6 +830,13 @@
     }
   
     /**
  +   * @deprecated Use the alternate form taking a parameter of type Level.
  +   */
  +  public boolean isEnabledFor(Priority level) {
  +    return isEnabledFor((Level) level);
  +  }
  +  
  +  /**
      * Check whether this category is enabled for the info Level. See also
      * [EMAIL PROTECTED] #isDebugEnabled}.
      *
  @@ -899,6 +906,13 @@
     }
   
     /**
  +   * @deprecated Use the form taking in a Level as a parameter.
  +   */
  +  public void log(Priority level, Object message, Throwable t) {
  +    log((Level) level, message, t);
  +  }
  +  
  +  /**
      * This generic form is intended to be used by wrappers.
      */
     public void log(Level level, Object message, Throwable t) {
  @@ -912,9 +926,18 @@
     }
   
     /**
  -   * This generic form is intended to be used by wrappers.
  +   * @deprecated Use the form taking in a Level as a parameter.
      */
  -  public void log(Level level, Object message) {
  +  public void log(Priority level, Object message) {
  +    log((Level) level, message);
  +   }
  +  
  +  /**
  +   * This generic form is intended to be used by wrappers. For the extraction
  +   * of caller information, use the most generic form [EMAIL PROTECTED] #log(
  +    String callerFQCN, Level level, Object message, Throwable t)}.
  +   */
  +   public void log(Level level, Object message) {
       if (repository.isDisabled(level.level)) {
         return;
       }
  @@ -944,6 +967,16 @@
       }
     }
   
  +  /**
  +   * @deprecated Use the form taking in a Level as a parameter.
  +   */
  +  public void log(
  +      String callerFQCN, Priority level, Object message, Throwable t) {
  +    log(callerFQCN, (Level) level, message, t);
  +  }
  +  
  +
  +  
     /**
      * Remove all previously added appenders from this Category instance.
      * <p>Removed appenders are closed.</p>
  
  
  
  1.65      +5 -4      logging-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java
  
  Index: DOMConfigurator.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- DOMConfigurator.java      12 May 2004 15:39:04 -0000      1.64
  +++ DOMConfigurator.java      19 May 2004 13:15:44 -0000      1.65
  @@ -293,15 +293,15 @@
   
         if (hasParamTag(currentElement)) {
           if (debug) {
  -          logger.debug(
  -            "Configuring parameter [" + currentElement.getAttribute("name")
  +          LogLog.debug(
  +            "***Configuring parameter [" + currentElement.getAttribute("name")
               + "] for <" + nestedElementTagName + ">.");
           }
   
           setParameter(currentElement, nestedBean);
         } else {
           if (debug) {
  -          logger.debug(
  +          LogLog.debug(
               "Configuring component " + nestedComponent + " with tagged as <"
               + currentElement.getTagName() + ">.");
           }
  @@ -394,7 +394,7 @@
     /**
        Used internally to parse a filter element.
      */
  -  protected void parseFilters(Element element, Appender appender) {
  +  protected void XXparseFilters(Element element, Appender appender) {
       String clazz = subst(element.getAttribute(CLASS_ATTR));
       Filter filter =
         (Filter) OptionConverter.instantiateByClassName(
  @@ -635,6 +635,7 @@
       String name = subst(elem.getAttribute(NAME_ATTR));
       String value = (elem.getAttribute(VALUE_ATTR));
       value = subst(OptionConverter.convertSpecialChars(value));
  +    //LogLog.debug("*** value is "+value);
       propSetter.setProperty(name, value);
     }
   
  
  
  
  1.8       +43 -31    
logging-log4j/src/java/org/apache/log4j/varia/LevelMatchFilter.java
  
  Index: LevelMatchFilter.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/varia/LevelMatchFilter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LevelMatchFilter.java     9 Oct 2002 22:50:06 -0000       1.7
  +++ LevelMatchFilter.java     19 May 2004 13:15:44 -0000      1.8
  @@ -1,16 +1,27 @@
   /*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  + * Copyright 1999,2004 The Apache Software Foundation.
    *
  - * 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.txt file.  */
  + * 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.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   
   package org.apache.log4j.varia;
   
   import org.apache.log4j.Level;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.helpers.OptionConverter;
   import org.apache.log4j.spi.Filter;
   import org.apache.log4j.spi.LoggingEvent;
  -import org.apache.log4j.helpers.OptionConverter;
  +
   
   /**
      This is a very simple filter based on level matching.
  @@ -28,7 +39,6 @@
   
      @since 1.2 */
   public class LevelMatchFilter extends Filter {
  -  
     /**
        Do we return ACCEPT when a match occurs. Default is
        <code>true</code>.  */
  @@ -38,27 +48,23 @@
      */
     Level levelToMatch;
   
  - 
  -  public
  -  void setLevelToMatch(String level) {
  +  public void setLevelToMatch(String level) {
       levelToMatch = OptionConverter.toLevel(level, null);
  +    LogLog.debug("***Level to match set to " + levelToMatch);
     }
  -  
  -  public
  -  String getLevelToMatch() {
  -    return levelToMatch == null ? null : levelToMatch.toString();
  +
  +  public String getLevelToMatch() {
  +    return (levelToMatch == null) ? null : levelToMatch.toString();
     }
  -  
  -  public
  -  void setAcceptOnMatch(boolean acceptOnMatch) {
  +
  +  public void setAcceptOnMatch(boolean acceptOnMatch) {
       this.acceptOnMatch = acceptOnMatch;
     }
  -  
  -  public
  -  boolean getAcceptOnMatch() {
  +
  +  public boolean getAcceptOnMatch() {
       return acceptOnMatch;
     }
  -  
  +
   
     /**
        Return the decision of this filter.
  @@ -71,22 +77,28 @@
        <b>AcceptOnMatch</b> property is set to false.
   
     */
  -  public
  -  int decide(LoggingEvent event) {
  -    if(this.levelToMatch == null) {
  +  public int decide(LoggingEvent event) {
  +    if (this.levelToMatch == null) {
         return Filter.NEUTRAL;
       }
  -    
  +
  +    LogLog.debug(
  +      "*** levelToMatch is " + levelToMatch + ", event.level is "
  +      + event.getLevel());
  +
       boolean matchOccured = false;
  -    if(this.levelToMatch.equals(event.getLevel())) {
  +
  +    if (this.levelToMatch.equals(event.getLevel())) {
  +      LogLog.debug("**********matchOccured");
         matchOccured = true;
  -    } 
  +    }
   
  -    if(matchOccured) {  
  -      if(this.acceptOnMatch)
  -       return Filter.ACCEPT;
  -      else
  -       return Filter.DENY;
  +    if (matchOccured) {
  +      if (this.acceptOnMatch) {
  +        return Filter.ACCEPT;
  +      } else {
  +        return Filter.DENY;
  +      }
       } else {
         return Filter.NEUTRAL;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to