You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-cvs@jakarta.apache.org by ce...@apache.org on 2001/09/02 23:40:36 UTC

cvs commit: jakarta-log4j/src/java/org/apache/log4j/xml/examples XCategory.java

ceki        01/09/02 14:40:36

  Modified:    src/java/org/apache/log4j Category.java
                        DefaultCategoryFactory.java Hierarchy.java Makefile
                        PropertyConfigurator.java ProvisionNode.java
                        TTCCLayout.java
               src/java/org/apache/log4j/examples MyCategoryFactory.java
               src/java/org/apache/log4j/examples/appserver
                        AppServerCategory.java
                        AppServerCategoryFactory.java
               src/java/org/apache/log4j/helpers OptionConverter.java
                        PatternParser.java
               src/java/org/apache/log4j/net JMSSink.java SocketNode.java
               src/java/org/apache/log4j/spi CategoryFactory.java
                        HierarchyEventListener.java LoggingEvent.java
               src/java/org/apache/log4j/test FQCNTest.java Makefile
               src/java/org/apache/log4j/xml DOMConfigurator.java
                        XMLLayout.java
               src/java/org/apache/log4j/xml/examples XCategory.java
  Added:       src/java/org/apache/log4j/test UnitTestLogger.java
  Removed:     src/java/org/apache/log4j/test UnitTestCategory.java
  Log:
  Initial attempt at renaming Category as Logger. As far as I can tell,
  it also preserves backward compatibility.
  
  Revision  Changes    Path
  1.43      +11 -892   jakarta-log4j/src/java/org/apache/log4j/Category.java
  
  Index: Category.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Category.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Category.java	2001/09/02 20:05:39	1.42
  +++ Category.java	2001/09/02 21:40:35	1.43
  @@ -52,169 +52,12 @@
   
     @author Ceki Gülcü
     @author Anders Kristensen */
  -public class Category implements AppenderAttachable {
  +public class Category extends Logger implements AppenderAttachable {
   
  -  /**
  -     The hierarchy where categories are attached to by default.
  -  */
  -  static 
  -  public 
  -  final Hierarchy defaultHierarchy = new Hierarchy(new 
  -						   RootCategory(Level.DEBUG));
  -
  -
  -  /**
  -     This string constant is set to <b>log4j.properties</b> the name
  -     of the file that will be searched by default in classpath. If the
  -     file can be found, then it is fed to the {@link
  -     PropertyConfigurator}.
  -
  -     See also {@link #DEFAULT_CONFIGURATION_KEY} for a more general
  -     alternative.
  -
  -     <p>See also the full description of <a
  -     href="../../../../manual.html#defaultInit">default
  -     intialization</a> procedure.
  -
  -     @since 0.8.5 */
  -     static public final String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
  -     
  -  /**
  -     This string constant is set to <b>log4j.configuration</b>. 
  -
  -     <p>It corresponds to name of a system property that, if set,
  -     specifies the name of the resource containing the properties file
  -     or {@link URL} with which log4j should configure itself. See
  -     {@link OptionConverter#selectAndConfigure} for more detailed
  -     information on the processing of this option.
  -
  -     <p>Setting the <b>log4j.configuration</b> system property
  -     overrides the default search for the file <b>log4j.properties</b>.
  -
  -     <p>Note that all property keys are case sensitive.  
  -
  -     <p>See also the full description of <a
  -     href="../../../../manual.html#defaultInit">default
  -     intialization</a> procedure.
  -
  -     @since 1.0 */
  -     static final public String DEFAULT_CONFIGURATION_KEY="log4j.configuration";
  -
  - /**
  -     This string constant is set to <b>log4j.configuratorClass</b>. 
  -
  -     <p>It corresponds to name of a system property that, if set,
  -     specifies the class name to use to automatically configure
  -     log4j. See {@link OptionConverter#selectAndConfigure} for more
  -     detailed information on the processing of this option.
  -
  -     <p>Setting the <b>log4j.configuration</b> system property
  -     overrides the default search for the file <b>log4j.properties</b>.
  -
  -     <p>Note that all property keys are case sensitive.  
  -
  -     <p>See also the full description of <a
  -     href="../../../../manual.html#defaultInit">default
  -     intialization</a> procedure.
  -   
  -     @since 1.2 */
  -     static final public String CONFIGURATOR_CLASS_KEY="log4j.configuratorClass";
  -
  -  /**
  -      Setting the system property <b>log4j.defaultInitOverride</b> to
  -      "true" or any other value than "false" will skip default
  -      configuration process.
  -
  -     <p>The current value of the DEFAULT_INIT_OVERRIDE_KEY string
  -     constant is <b>log4j.defaultInitOverride</b>.
  -
  -     <p>See also the full description of <a
  -     href="../../../../manual.html#defaultInit">default
  -     intialization</a> procedure.
  -
  -     <p>Note that all property keys are case sensitive.  
  -
  -     @since 0.8.5 */
  -  public static final String DEFAULT_INIT_OVERRIDE_KEY = 
  -                                                 "log4j.defaultInitOverride";
  -
  -  /** Search for the properties file log4j.properties in the CLASSPATH.  */
  -  static {
  -
  -    String override =OptionConverter.getSystemProperty(DEFAULT_INIT_OVERRIDE_KEY,
  -						       null);
  -
  -    // if there is no default init override, them get the resource
  -    // specified by the user or the default config file.
  -    if(override == null || "false".equalsIgnoreCase(override)) {
  -      String resource = OptionConverter.getSystemProperty(
  -                                                   DEFAULT_CONFIGURATION_KEY, 
  -						   DEFAULT_CONFIGURATION_FILE);
  -
  -      String configuratorClassName = OptionConverter.getSystemProperty(
  -                                                   CONFIGURATOR_CLASS_KEY, 
  -						   null);
  -
  -      URL url = null;
  -      try {
  -	// so, resource is not a URL:
  -	// attempt to get the resource from the class path
  -	url = new URL(resource);
  -      } catch (MalformedURLException ex) {
  -	url = Loader.getResource(resource); 
  -      }	
  -      
  -      // If we have a non-null url, then delegate the rest of the
  -      // configuration to the OptionConverter.selectAndConfigure
  -      // method.
  -      if(url != null) {
  -	LogLog.debug("Using URL ["+url+"] for automatic log4j configuration.");
  -	OptionConverter.selectAndConfigure(url, configuratorClassName, 
  -					   defaultHierarchy);
  -      } else {
  -	LogLog.debug("Could not find resource: ["+resource+"].");
  -      }
  -    }  
  -  } 
  -
  -  /**
  -     The name of this category.
  -  */
  -  protected String   name;  
  -
  -  /**
  -     The assigned level of this category.  The
  -     <code>level</code> variable need not be assined a value in
  -     which case it is inherited form the hierarchy.  */
  -  volatile protected Level level;
  -
  -  /**
  -     The parent of this category. All categories have at least one
  -     ancestor which is the root category. */
  -  volatile protected Category parent;
  -
  -  /**
  -     The fully qualified name of the Category class. See also the 
  -     getFQCN method. */
     private static final String FQCN = Category.class.getName();
  -  
  -  protected ResourceBundle resourceBundle;
  -  
  -  // Categories need to know what Hierarchy they are in
  -  protected Hierarchy hierarchy;
  -
   
  -  AppenderAttachableImpl aai;
  -
  -  /** Additivity is set to true by default, that is children inherit
  -      the appenders of their ancestors by default. If this variable is
  -      set to <code>false</code> then the appenders found in the
  -      ancestors of this category are not used. However, the children
  -      of this category will inherit its appenders, unless the children
  -      have their additivity flag set to <code>false</code> too. See
  -      the user manual for more details. */
  -  protected boolean additive = true;
  -  
  +  private static CategoryFactory factory = new DefaultCategoryFactory();
  +    
     /**
        This constructor created a new <code>Category</code> instance and
        sets its name.
  @@ -226,98 +69,9 @@
     */
     protected 
     Category(String name) {
  -    this.name = name;
  -  }
  -
  -  /**
  -     Add <code>newAppender</code> to the list of appenders of this
  -     Category instance.
  -
  -     <p>If <code>newAppender</code> is already in the list of
  -     appenders, then it won't be added again.
  -  */
  -  synchronized  
  -  public 
  -  void addAppender(Appender newAppender) {
  -    if(aai == null) {
  -      aai = new AppenderAttachableImpl();
  -    }
  -    aai.addAppender(newAppender);
  -    hierarchy.fireAddAppenderEvent(this, newAppender);
  -  }
  -
  -  /**
  -     If <code>assertion</code> parameter is <code>false</code>, then
  -     logs <code>msg</code> as an {@link #error(Object) error} statement.
  -
  -     <p>The <code>assert</code> method has been renamed to
  -     <code>assertLog</code> because <code>assert</code> is a language
  -     reserved word in JDK 1.4.
  -
  -     @param assertion 
  -     @param msg The message to print if <code>assertion</code> is
  -     false.
  -
  -     @since 1.2 */
  -  public
  -  void assertLog(boolean assertion, String msg) {
  -    if(!assertion)
  -      this.error(msg);
  -  }
  -  
  -
  -  /**
  -     Call the appenders in the hierrachy starting at
  -     <code>this</code>.  If no appenders could be found, emit a
  -     warning.
  -
  -     <p>This method calls all the appenders inherited from the
  -     hierarchy circumventing any evaluation of whether to log or not
  -     to log the particular log request.
  -     
  -     @param LoggingEvent the event to log.  */
  -  public
  -  void callAppenders(LoggingEvent event) {
  -    int writes = 0;
  -
  -    for(Category c = this; c != null; c=c.parent) {
  -      // Protected against simultaneous call to addAppender, removeAppender,...
  -      synchronized(c) {
  -	if(c.aai != null) {
  -	  writes += c.aai.appendLoopOnAppenders(event);
  -	}
  -	if(!c.additive) {
  -	  break;
  -	}
  -      }
  -    }
  -    // No appenders in hierarchy, warn user only once.
  -    if(!hierarchy.emittedNoAppenderWarning && writes == 0) {
  -      LogLog.error("No appenders could be found for category (" +
  -		    this.getName() + ").");
  -      LogLog.error("Please initialize the log4j system properly.");
  -      hierarchy.emittedNoAppenderWarning = true;
  -    }
  +    super(name);
     }
   
  -  /**
  -     Close all attached appenders implementing the AppenderAttachable
  -     interface.  
  -     @since 1.0
  -  */
  -  synchronized
  -  void closeNestedAppenders() {
  -    Enumeration enum = this.getAllAppenders();
  -    if(enum != null) {
  -      while(enum.hasMoreElements()) {
  -	Appender a = (Appender) enum.nextElement();
  -	if(a instanceof AppenderAttachable) {
  -	  a.close();
  -	}
  -      }
  -    }
  -  }
  -
     /** 
       Log a message object with the {@link Level#DEBUG DEBUG} level.
   
  @@ -398,146 +152,7 @@
         forcedLog(FQCN, Level.ERROR, message, null);
     }
   
  -  /** 
  -   Log a message object with the <code>ERROR</code> level including
  -   the stack trace of the {@link Throwable} <code>t</code> passed as
  -   parameter.
  -   
  -   <p>See {@link #error(Object)} form for more detailed information.
  -   
  -   @param message the message object to log.
  -   @param t the exception to log, including its stack trace.  */  
  -  public
  -  void error(Object message, Throwable t) {
  -    if(hierarchy.enableInt >  Level.ERROR_INT) 
  -      return;
  -    if(Level.ERROR.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.ERROR, message, t);
  -    
  -  }
  -
  -
     /**
  -     If the named category exists (in the default hierarchy) then it
  -     returns a reference to the category, otherwise it returns
  -     <code>null</code>.
  -     
  -     <p>Contributed by Ciaran Treanor -  ciaran@xelector.com
  -     @version 0.8.5 */
  -  public
  -  static
  -  Category exists(String name) {    
  -    return defaultHierarchy.exists(name);
  -  }
  -
  -  /** 
  -    Log a message object with the {@link Level#FATAL FATAL} Level.
  -
  -    <p>This method first checks if this category is <code>FATAL</code>
  -    enabled by comparing the level of this category with {@link
  -    Level#FATAL FATAL} Level. If the category is <code>FATAL</code>
  -    enabled, then it converts the message object passed as parameter
  -    to a string by invoking the appropriate {@link ObjectRenderer}. It
  -    proceeds to call all the registered appenders in this category and
  -    also higher in the hierarchy depending on the value of the
  -    additivity flag.
  -
  -    <p><b>WARNING</b> Note that passing a {@link Throwable} to this
  -    method will print the name of the Throwable but no stack trace. To
  -    print a stack trace use the {@link #fatal(Object, Throwable)} form
  -    instead. 
  -    
  -    @param message the message object to log */
  -  public
  -  void fatal(Object message) {
  -    if(hierarchy.enableInt >  Level.FATAL_INT) 
  -      return;    
  -    if(Level.FATAL.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.FATAL, message, null);
  -  }
  -  
  -  /** 
  -   Log a message object with the <code>FATAL</code> level including
  -   the stack trace of the {@link Throwable} <code>t</code> passed as
  -   parameter.
  -   
  -   <p>See {@link #fatal(Object)} for more detailed information.
  -   
  -   @param message the message object to log.
  -   @param t the exception to log, including its stack trace.  */
  -  public
  -  void fatal(Object message, Throwable t) {
  -    if(hierarchy.enableInt >  Level.FATAL_INT) 
  -      return;   
  -    if(Level.FATAL.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.FATAL, message, t);
  -  }
  -
  -
  -  /**
  -     This method creates a new logging event and logs the event
  -     without further checks.  */
  -  protected
  -  void forcedLog(String fqcn, Level level, Object message, Throwable t) {
  -    callAppenders(new LoggingEvent(fqcn, this, level, message, t));
  -  }
  -
  -
  -  /**
  -     Get the additivity flag for this Category instance.  
  -  */
  -  public
  -  boolean getAdditivity() {
  -    return additive;
  -  }
  -
  -  /**
  -     Get the appenders contained in this category as an {@link
  -     Enumeration}. If no appenders can be found, then a {@link NullEnumeration}
  -     is returned.
  -     
  -     @return Enumeration An enumeration of the appenders in this category.  */
  -  synchronized
  -  public
  -  Enumeration getAllAppenders() {
  -    if(aai == null)
  -      return NullEnumeration.getInstance();
  -    else 
  -      return aai.getAllAppenders();
  -  }
  -
  -  /**
  -     Look for the appender named as <code>name</code>.
  -
  -     <p>Return the appender with that name if in the list. Return
  -     <code>null</code> otherwise.  */
  -  synchronized
  -  public
  -  Appender getAppender(String name) {
  -     if(aai == null || name == null)
  -      return null;
  -
  -     return aai.getAppender(name);
  -  }
  -  
  -  /**
  -     Starting from this category, search the category hierarchy for a
  -     non-null level and return it. Otherwise, return the level of the
  -     root category.
  -     
  -     <p>The Category class is designed so that this method executes as
  -     quickly as possible.
  -   */
  -  public 
  -  Level getChainedLevel() {
  -    for(Category c = this; c != null; c=c.parent) {
  -      if(c.level != null) 
  -	return c.level;
  -    }
  -    return null; // If reached will cause an NullPointerException.
  -  }
  -
  -  /**
        Returns all the currently defined categories in the default
        hierarchy as an {@link java.util.Enumeration Enumeration}.
   
  @@ -551,29 +166,6 @@
     }
   
   
  -  /**
  -     Return the default Hierarchy instance.
  -
  -     @since 1.0
  -   */
  -  public 
  -  static 
  -  Hierarchy getDefaultHierarchy() {
  -    return defaultHierarchy;
  -  }
  -
  -  
  -  /**
  -     Return the the {@link Hierarchy} where this <code>Category</code> instance is
  -     attached.
  -
  -     @since 1.1 */
  -  public  
  -  Hierarchy getHierarchy() {
  -    return hierarchy;
  -  }
  -
  -  
    /**
        Retrieve a category with named as the <code>name</code>
        parameter. If the named category already exists, then the
  @@ -583,12 +175,15 @@
        By default, categories do not have a set level but inherit
        it from the hierarchy. This is one of the central features of
        log4j.
  +
  +     @param name The name of the category to retrieve. 
   
  -     @param name The name of the category to retrieve.  */
  +
  + */
     public
     static
     Category getInstance(String name) {
  -    return defaultHierarchy.getInstance(name);
  +    return (Category) defaultHierarchy.getLogger(name, factory);
     }	
   
    /**
  @@ -623,489 +218,13 @@
     public
     static
     Category getInstance(String name, CategoryFactory factory) {
  -    return defaultHierarchy.getInstance(name, factory);
  +    return (Category) defaultHierarchy.getLogger(name, factory);
     }	
   
  -  
  -  /**
  -     Return the category name.  */
  -  public
  -  final
  -  String getName() {
  -    return name;
  -  }
   
  -    
  -  /**
  -     Returns the parent of this category. Note that the parent of a
  -     given category may change during the lifetime of the category.
  -     
  -     <p>The root category will return <code>null</code>.
  -
  -     @since 1.2
  -  */
  -  final
  -  public
  -  Category getParent() {
  -    return this.parent;
  -  }
  -
  -    
  -  /**
  -     Returns the assigned {@link Level}, if any, for this Category.  
  -     
  -     @return Level - the assigned Level, can be <code>null</code>.
  -  */
  -  final
  -  public
  -  Level getLevel() {
  -    return this.level;
  -  }
  -
  -  /**
  -     @deprecated Please use {@link #getLevel} instead.
  -  */
  -  final
     public
  -  Level getPriority() {
  -    return this.level;
  -  }
  -
  -
  -  /**
  -     Return the root of the default category hierrachy.
  -
  -     <p>The root category is always instantiated and available. It's
  -     name is "root".
  -
  -     <p>Nevertheless, calling {@link #getInstance
  -     Category.getInstance("root")} does not retrieve the root category 
  -     but a category just under root named "root".
  -     
  -   */
  -  final
  -  public
     static
     Category getRoot() {
  -    return defaultHierarchy.getRoot();
  -  }
  -
  -  /**
  -     Return the <em>inherited</em> {@link ResourceBundle} for this
  -     category.
  -
  -     <p>This method walks the hierarchy to find the appropriate
  -     resource bundle. It will return the resource bundle attached to
  -     the closest ancestor of this category, much like the way
  -     priorities are searched. In case there is no bundle in the
  -     hierarchy then <code>null</code> is returned.
  -
  -     @since 0.9.0 */
  -  public
  -  ResourceBundle getResourceBundle() {
  -    for(Category c = this; c != null; c=c.parent) {
  -      if(c.resourceBundle != null) 
  -	return c.resourceBundle;
  -    }
  -    // It might be the case that there is no resource bundle 
  -    return null;
  -  }
  -
  -  /**
  -     Returns the string resource coresponding to <code>key</code> in
  -     this category's inherited resource bundle. See also {@link
  -     #getResourceBundle}.
  -
  -     <p>If the resource cannot be found, then an {@link #error error}
  -     message will be logged complaining about the missing resource.
  -  */
  -  protected
  -  String getResourceBundleString(String key) {
  -    ResourceBundle rb = getResourceBundle();
  -    // This is one of the rare cases where we can use logging in order
  -    // to report errors from within log4j.
  -    if(rb == null) {
  -      if(!hierarchy.emittedNoResourceBundleWarning) {
  -	error("No resource bundle has been set for category "+name);
  -	hierarchy.emittedNoResourceBundleWarning = true;
  -      }
  -      return null;
  -    }
  -    else {
  -      try {
  -	return rb.getString(key);
  -      }
  -      catch(MissingResourceException mre) {
  -	error("No resource is associated with key \""+key+"\".");
  -	return null;
  -      }
  -    }
  -  }
  -  
  -  /** 
  -    Log a message object with the {@link Level#INFO INFO} Level.
  -
  -    <p>This method first checks if this category is <code>INFO</code>
  -    enabled by comparing the level of this category with {@link
  -    Level#INFO INFO} Level. If the category is <code>INFO</code>
  -    enabled, then it converts the message object passed as parameter
  -    to a string by invoking the appropriate {@link ObjectRenderer}. It
  -    proceeds to call all the registered appenders in this category and
  -    also higher in the hierarchy depending on the value of the
  -    additivity flag.
  -
  -    <p><b>WARNING</b> Note that passing a {@link Throwable} to this
  -    method will print the name of the Throwable but no stack trace. To
  -    print a stack trace use the {@link #info(Object, Throwable)} form
  -    instead. 
  -    
  -    @param message the message object to log */
  -  public
  -  void info(Object message) {
  -    if(hierarchy.enableInt >  Level.INFO_INT) 
  -      return;    
  -    if(Level.INFO.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.INFO, message, null);
  -  }
  -  
  -  /** 
  -   Log a message object with the <code>INFO</code> level including
  -   the stack trace of the {@link Throwable} <code>t</code> passed as
  -   parameter.
  -   
  -   <p>See {@link #info(Object)} for more detailed information.
  -   
  -   @param message the message object to log.
  -   @param t the exception to log, including its stack trace.  */
  -  public
  -  void info(Object message, Throwable t) {
  -    if(hierarchy.enableInt >  Level.INFO_INT) 
  -      return;   
  -    if(Level.INFO.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.INFO, message, t);
  -  }
  -
  -  /**
  -    *  Check whether this category is enabled for the <code>DEBUG</code>
  -    *  Level.
  -    *  
  -    *  <p> This function is intended to lessen the computational cost of
  -    *  disabled log debug statements.
  -    * 
  -    *  <p> For some <code>cat</code> Category object, when you write,
  -    *  <pre>
  -    *      cat.debug("This is entry number: " + i );
  -    *  </pre>
  -    *  
  -    *  <p>You incur the cost constructing the message, concatenatiion in
  -    *  this case, regardless of whether the message is logged or not.
  -    * 
  -    *  <p>If you are worried about speed, then you should write
  -    *  <pre>
  -    * 	 if(cat.isDebugEnabled()) { 
  -    * 	   cat.debug("This is entry number: " + i );
  -    * 	 }
  -    *  </pre>
  -    * 
  -    *  <p>This way you will not incur the cost of parameter
  -    *  construction if debugging is disabled for <code>cat</code>. On
  -    *  the other hand, if the <code>cat</code> is debug enabled, you
  -    *  will incur the cost of evaluating whether the category is debug
  -    *  enabled twice. Once in <code>isDebugEnabled</code> and once in
  -    *  the <code>debug</code>.  This is an insignificant overhead
  -    *  since evaluating a category takes about 1%% of the time it
  -    *  takes to actually log.
  -    * 
  -    *  @return boolean - <code>true</code> if this category is debug
  -    *  enabled, <code>false</code> otherwise.
  -    *   */
  -  public
  -  boolean isDebugEnabled() {
  -    if(hierarchy.enableInt >  Level.DEBUG_INT)
  -      return false;   
  -    return Level.DEBUG.isGreaterOrEqual(this.getChainedLevel());
  -  }
  -  
  -  /**
  -     Check whether this category is enabled for a given {@link
  -     Level} passed as parameter.
  -
  -     See also {@link #isDebugEnabled}.
  -       
  -     @return boolean True if this category is enabled for <code>level</code>.
  -  */
  -  public
  -  boolean isEnabledFor(Level level) {
  -    if(hierarchy.enableInt >  level.level) 
  -      return false;
  -    return level.isGreaterOrEqual(this.getChainedLevel());
  -  }
  -
  -  /**
  -    Check whether this category is enabled for the info Level.
  -    See also {@link #isDebugEnabled}.
  -
  -    @return boolean - <code>true</code> if this category is enabled
  -    for level info, <code>false</code> otherwise.
  -  */
  -  public
  -  boolean isInfoEnabled() {
  -    if(hierarchy.enableInt > Level.INFO_INT)
  -      return false;   
  -    return Level.INFO.isGreaterOrEqual(this.getChainedLevel());
  -  }
  -
  -
  -  /**
  -     Log a localized message. The user supplied parameter
  -     <code>key</code> is replaced by its localized version from the
  -     resource bundle.
  -     
  -     @see #setResourceBundle
  -
  -     @since 0.8.4 */
  -  public
  -  void l7dlog(Level level, String key, Throwable t) {
  -    if(hierarchy.enableInt > level.level) {
  -      return;
  -    }
  -    if(level.isGreaterOrEqual(this.getChainedLevel())) {
  -      String msg = getResourceBundleString(key);
  -      // if message corresponding to 'key' could not be found in the
  -      // resource bundle, then default to 'key'.
  -      if(msg == null) {
  -	msg = key;
  -      }
  -      forcedLog(FQCN, level, msg, t);
  -    }
  -  }
  -  /**
  -     Log a localized and parameterized message. First, the user
  -     supplied <code>key</code> is searched in the resource
  -     bundle. Next, the resulting pattern is formatted using 
  -     {@link MessageFormat#format(String,Object[])} method with the user
  -     supplied object array <code>params</code>.
  -     
  -     @since 0.8.4
  -  */
  -  public
  -  void l7dlog(Level level, String key,  Object[] params, Throwable t) {
  -    if(hierarchy.enableInt > level.level) {
  -      return;
  -    }    
  -    if(level.isGreaterOrEqual(this.getChainedLevel())) {
  -      String pattern = getResourceBundleString(key);
  -      String msg;
  -      if(pattern == null) 
  -	msg = key;
  -      else 
  -	msg = java.text.MessageFormat.format(pattern, params);
  -      forcedLog(FQCN, level, msg, t);
  -    }
  -  }
  -  
  -  /**
  -     This generic form is intended to be used by wrappers.
  -   */
  -  public
  -  void log(Level level, Object message, Throwable t) {
  -    if(hierarchy.enableInt > level.level) {
  -      return;
  -    }
  -    if(level.isGreaterOrEqual(this.getChainedLevel())) 
  -      forcedLog(FQCN, level, message, t);
  -  }
  -  
  - /**
  -    This generic form is intended to be used by wrappers. 
  - */
  -  public
  -  void log(Level level, Object message) {
  -    if(hierarchy.enableInt > level.level) {
  -      return;
  -    }
  -    if(level.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, level, message, null);
  -  }
  -
  -  /**
  -     
  -     This is the most generic printing method. It is intended to be
  -     invoked by <b>wrapper</b> classes.
  -          
  -     @param callerFQCN The wrapper class' fully qualified class name.
  -     @param level The level of the logging request.
  -     @param message The message of the logging request.
  -     @param t The throwable of the logging request, may be null.  */
  -  public
  -  void log(String callerFQCN, Level level, Object message, Throwable t) {
  -    if(hierarchy.enableInt > level.level) {
  -      return;
  -    }
  -    if(level.isGreaterOrEqual(this.getChainedLevel())) {
  -      forcedLog(callerFQCN, level, message, t);
  -    }
  -  }
  -
  -
  -  /**
  -     Remove all previously added appenders from this Category
  -     instance.
  -
  -     <p>This is useful when re-reading configuration information.
  -  */
  -  synchronized
  -  public
  -  void removeAllAppenders() {
  -    if(aai != null) {
  -      aai.removeAllAppenders();
  -      aai = null;
  -    }
  -  }
  -
  -  /**
  -     Remove the appender passed as parameter form the list of appenders.
  -
  -     @since 0.8.2
  -  */
  -  synchronized
  -  public
  -  void removeAppender(Appender appender) {
  -    if(appender == null || aai == null) 
  -      return;
  -    aai.removeAppender(appender);
  -  }
  -
  -  /**
  -     Remove the appender with the name passed as parameter form the
  -     list of appenders.
  -
  -     @since 0.8.2 */
  -  synchronized
  -  public
  -  void removeAppender(String name) {
  -    if(name == null || aai == null) return;
  -    aai.removeAppender(name);
  -  }
  -  
  -  /**
  -     Set the additivity flag for this Category instance.
  -     @since 0.8.1
  -   */
  -  public
  -  void setAdditivity(boolean additive) {
  -    this.additive = additive;
  -  }
  -
  -  /**
  -     Only the Hiearchy class can set the hiearchy of a
  -     category. Default package access is MANDATORY here.  */
  -  final
  -  void setHierarchy(Hierarchy hierarchy) {
  -    this.hierarchy = hierarchy;
  -  }
  -
  -  /**
  -     Set the level of this Category.
  -
  -     <p>Null values are admitted.
  -  */
  -  public
  -  void setLevel(Level level) {
  -    this.level = level;
  -  }
  -
  -  
  -  /**
  -     Set the level of this Category.
  -
  -     <p>Null values are admitted.
  -
  -     @deprecated Please use {@link #setLevel} instead.
  -  */
  -  public
  -  void setPriority(Priority priority) {
  -    setLevel(priority);
  -  }
  -
  -
  -  /**
  -     Set the resource bundle to be used with localized logging
  -     methods {@link #l7dlog(Level,String,Throwable)} and {@link
  -     #l7dlog(Level,String,Object[],Throwable)}.
  -
  -     @since 0.8.4
  -   */
  -  public
  -  void setResourceBundle(ResourceBundle bundle) {
  -    resourceBundle = bundle;
  -  }
  -
  -  /**
  -     Calling this method will <em>safely</em> close and remove all
  -     appenders in all the categories including root contained in the
  -     default hierachy.
  -     
  -     <p>Some appenders such as {@link org.apache.log4j.net.SocketAppender}
  -     and {@link AsyncAppender} need to be closed before the
  -     application exists. Otherwise, pending logging events might be
  -     lost.
  -
  -     <p>The <code>shutdown</code> method is careful to close nested
  -     appenders before closing regular appenders. This is allows
  -     configurations where a regular appender is attached to a category
  -     and again to a nested appender.  
  -
  -     @since 1.0
  -  */
  -  public
  -  static
  -  void shutdown() {
  -    defaultHierarchy.shutdown();
  -  }
  -
  -  
  -  /** 
  -    Log a message object with the {@link Level#WARN WARN} Level.
  -
  -    <p>This method first checks if this category is <code>WARN</code>
  -    enabled by comparing the level of this category with {@link
  -    Level#WARN WARN} Level. If the category is <code>WARN</code>
  -    enabled, then it converts the message object passed as parameter
  -    to a string by invoking the appropriate {@link ObjectRenderer}. It
  -    proceeds to call all the registered appenders in this category and
  -    also higher in the hieararchy depending on the value of the
  -    additivity flag.
  -
  -    <p><b>WARNING</b> Note that passing a {@link Throwable} to this
  -    method will print the name of the Throwable but no stack trace. To
  -    print a stack trace use the {@link #warn(Object, Throwable)} form
  -    instead.  <p>
  -    
  -    @param message the message object to log.  */
  -  public
  -  void warn(Object message) {
  -    if(hierarchy.enableInt >  Level.WARN_INT) 
  -      return;   
  -
  -    if(Level.WARN.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.WARN, message, null);    
  -  }
  -  
  -  /** 
  -   Log a message with the <code>WARN</code> level including the
  -   stack trace of the {@link Throwable} <code>t</code> passed as
  -   parameter.
  -   
  -   <p>See {@link #warn(Object)} for more detailed information.
  -   
  -   @param message the message object to log.
  -   @param t the exception to log, including its stack trace.  */
  -  public
  -  void warn(Object message, Throwable t) {
  -    if(hierarchy.enableInt >  Level.WARN_INT) 
  -      return;   
  -    if(Level.WARN.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.WARN, message, t);
  +    return (Category) defaultHierarchy.getRootLogger();
     }
   }
  
  
  
  1.6       +1 -1      jakarta-log4j/src/java/org/apache/log4j/DefaultCategoryFactory.java
  
  Index: DefaultCategoryFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/DefaultCategoryFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultCategoryFactory.java	2001/07/13 07:52:56	1.5
  +++ DefaultCategoryFactory.java	2001/09/02 21:40:35	1.6
  @@ -15,7 +15,7 @@
     }    
       
     public
  -  Category makeNewCategoryInstance(String name) {
  +  Logger makeNewCategoryInstance(String name) {
       return new Category(name);
     }    
   }
  
  
  
  1.27      +50 -50    jakarta-log4j/src/java/org/apache/log4j/Hierarchy.java
  
  Index: Hierarchy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Hierarchy.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Hierarchy.java	2001/09/02 20:05:39	1.26
  +++ Hierarchy.java	2001/09/02 21:40:35	1.27
  @@ -126,10 +126,10 @@
        
     */
     public
  -  Category exists(String name) {    
  +  Logger exists(String name) {    
       Object o = ht.get(new CategoryKey(name));
  -    if(o instanceof Category) {
  -      return (Category) o;
  +    if(o instanceof Logger) {
  +      return (Logger) o;
       } else {
         return null;
       }
  @@ -263,25 +263,25 @@
   
   
     
  -  void fireAddAppenderEvent(Category category, Appender appender) {
  +  void fireAddAppenderEvent(Logger logger, Appender appender) {
       if(listeners != null) {
         int size = listeners.size();
         HierarchyEventListener listener;
         for(int i = 0; i < size; i++) {
   	listener = (HierarchyEventListener) listeners.elementAt(i);
  -	listener.addAppenderEvent(category, appender);
  +	listener.addAppenderEvent(logger, appender);
         }
       }        
     }
   
   
  -  void fireRemoveAppenderEvent(Category category, Appender appender) {
  +  void fireRemoveAppenderEvent(Logger logger, Appender appender) {
       if(listeners != null) {
         int size = listeners.size();
         HierarchyEventListener listener;
         for(int i = 0; i < size; i++) {
   	listener = (HierarchyEventListener) listeners.elementAt(i);
  -	listener.removeAppenderEvent(category, appender);
  +	listener.removeAppenderEvent(logger, appender);
         }
       }        
     }
  @@ -298,19 +298,19 @@
     }
   
     /**
  -     Return a new category instance named as the first parameter using
  +     Return a new logger instance named as the first parameter using
        the default factory. 
        
  -     <p>If a category of that name already exists, then it will be
  -     returned.  Otherwise, a new category will be instantiated and
  +     <p>If a logger of that name already exists, then it will be
  +     returned.  Otherwise, a new logger will be instantiated and
        then linked with its existing ancestors as well as children.
        
  -     @param name The name of the category to retrieve.
  +     @param name The name of the logger to retrieve.
   
    */
     public
  -  Category getInstance(String name) {
  -    return getInstance(name, defaultFactory);
  +  Logger getLogger(String name) {
  +    return getLogger(name, defaultFactory);
     }
   
    /**
  @@ -327,32 +327,32 @@
   
    */
     public
  -  Category getInstance(String name, CategoryFactory factory) {
  +  Logger getLogger(String name, CategoryFactory factory) {
       //System.out.println("getInstance("+name+") called.");
       CategoryKey key = new CategoryKey(name);    
       // Synchronize to prevent write conflicts. Read conflicts (in
       // getChainedLevel method) are possible only if variable
       // assignments are non-atomic.
  -    Category category;
  +    Logger logger;
       
       synchronized(ht) {
         Object o = ht.get(key);
         if(o == null) {
  -	category = factory.makeNewCategoryInstance(name);
  -	category.setHierarchy(this);
  -	ht.put(key, category);      
  -	updateParents(category);
  -	return category;
  -      } else if(o instanceof Category) {
  -	return (Category) o;
  +	logger = factory.makeNewCategoryInstance(name);
  +	logger.setHierarchy(this);
  +	ht.put(key, logger);      
  +	updateParents(logger);
  +	return logger;
  +      } else if(o instanceof Logger) {
  +	return (Logger) o;
         } else if (o instanceof ProvisionNode) {
   	//System.out.println("("+name+") ht.get(this) returned ProvisionNode");
  -	category = factory.makeNewCategoryInstance(name);
  -	category.setHierarchy(this); 
  -	ht.put(key, category);
  -	updateChildren((ProvisionNode) o, category);
  -	updateParents(category);	
  -	return category;
  +	logger = factory.makeNewCategoryInstance(name);
  +	logger.setHierarchy(this); 
  +	ht.put(key, logger);
  +	updateChildren((ProvisionNode) o, logger);
  +	updateParents(logger);	
  +	return logger;
         }
         else {
   	// It should be impossible to arrive here
  @@ -366,19 +366,19 @@
        Returns all the currently defined categories in this hierarchy as
        an {@link java.util.Enumeration Enumeration}.
   
  -     <p>The root category is <em>not</em> included in the returned
  +     <p>The root logger is <em>not</em> included in the returned
        {@link Enumeration}.  */
     public
     Enumeration getCurrentCategories() {
       // The accumlation in v is necessary because not all elements in
  -    // ht are Category objects as there might be some ProvisionNodes
  +    // ht are Logger objects as there might be some ProvisionNodes
       // as well.
       Vector v = new Vector(ht.size());
       
       Enumeration elems = ht.elements();
       while(elems.hasMoreElements()) {
         Object o = elems.nextElement();
  -      if(o instanceof Category) {
  +      if(o instanceof Logger) {
   	v.addElement(o);
         }
       }
  @@ -400,7 +400,7 @@
        @since 0.9.0
      */
     public
  -  Category getRoot() {
  +  Logger getRootLogger() {
       return root;
     }
   
  @@ -426,7 +426,7 @@
        default.  This removes all appenders from all categories, sets
        the level of all non-root categories to <code>null</code>,
        sets their additivity flag to <code>true</code> and sets the level
  -     of the root category to {@link Level#DEBUG DEBUG}.  Moreover,
  +     of the root logger to {@link Level#DEBUG DEBUG}.  Moreover,
        message disabling is set its default "off" value.
   
        <p>Existing categories are not removed. They are just reset.
  @@ -438,7 +438,7 @@
     public
     void resetConfiguration() {
   
  -    getRoot().setLevel(Level.DEBUG);
  +    getRootLogger().setLevel(Level.DEBUG);
       root.setResourceBundle(null);
       enableAll();
       
  @@ -449,7 +449,7 @@
       
         Enumeration cats = getCurrentCategories();
         while(cats.hasMoreElements()) {
  -	Category c = (Category) cats.nextElement();
  +	Logger c = (Logger) cats.nextElement();
   	c.setLevel(null);
   	c.setAdditivity(true);
   	c.setResourceBundle(null);
  @@ -459,7 +459,7 @@
     }
   
     /**
  -     Set the default CategoryFactory instance.
  +     Set the default LoggerFactory instance.
   
        @since 1.1
      */
  @@ -481,7 +481,7 @@
   
     /**
        Shutting down a hierarchy will <em>safely</em> close and remove
  -     all appenders in all categories including the root category.
  +     all appenders in all categories including the root logger.
        
        <p>Some appenders such as {@link org.apache.log4j.net.SocketAppender}
        and {@link AsyncAppender} need to be closed before the
  @@ -490,14 +490,14 @@
   
        <p>The <code>shutdown</code> method is careful to close nested
        appenders before closing regular appenders. This is allows
  -     configurations where a regular appender is attached to a category
  +     configurations where a regular appender is attached to a logger
        and again to a nested appender.
        
   
        @since 1.0 */
     public 
     void shutdown() {
  -    Category root = getRoot();    
  +    Logger root = getRootLogger();    
   
       // begin by closing nested appenders
       root.closeNestedAppenders();
  @@ -505,7 +505,7 @@
       synchronized(ht) {
         Enumeration cats = this.getCurrentCategories();
         while(cats.hasMoreElements()) {
  -	Category c = (Category) cats.nextElement();
  +	Logger c = (Logger) cats.nextElement();
   	c.closeNestedAppenders();
         }
   
  @@ -513,7 +513,7 @@
         root.removeAllAppenders();
         cats = this.getCurrentCategories();
         while(cats.hasMoreElements()) {
  -	Category c = (Category) cats.nextElement();
  +	Logger c = (Logger) cats.nextElement();
   	c.removeAllAppenders();
         }      
       }
  @@ -529,7 +529,7 @@
           We create a ProvisionNode for this potential parent and insert
           'cat' in that provision node.
   
  -     2) There entry is of type Category for the potential parent.
  +     2) There entry is of type Logger for the potential parent.
   
           The entry is 'cat's nearest existing parent. We update cat's
           parent field with this entry. We also break from the loop
  @@ -542,7 +542,7 @@
      */
     final
     private
  -  void updateParents(Category cat) {
  +  void updateParents(Logger cat) {
       String name = cat.name;
       int length = name.length();
       boolean parentFound = false;
  @@ -597,19 +597,19 @@
     */
     final
     private
  -  void updateChildren(ProvisionNode pn, Category cat) {
  -    //System.out.println("updateChildren called for " + cat.name);
  +  void updateChildren(ProvisionNode pn, Logger logger) {
  +    //System.out.println("updateChildren called for " + logger.name);
       final int last = pn.size();
   
       for(int i = 0; i < last; i++) {
  -      Category c = (Category) pn.elementAt(i);
  +      Logger l = (Logger) pn.elementAt(i);
         //System.out.println("Updating child " +p.name);
   
         // Unless this child already points to a correct (lower) parent,
  -      // make cat.parent point to c.parent and c.parent to cat.
  -      if(!c.parent.name.startsWith(cat.name)) {
  -	cat.parent = c.parent;
  -	c.parent = cat;      
  +      // make cat.parent point to l.parent and l.parent to cat.
  +      if(!l.parent.name.startsWith(logger.name)) {
  +	logger.parent = l.parent;
  +	l.parent = logger;      
         }
       }
     }    
  
  
  
  1.16      +4 -3      jakarta-log4j/src/java/org/apache/log4j/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Makefile,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Makefile	2001/09/02 20:05:39	1.15
  +++ Makefile	2001/09/02 21:40:35	1.16
  @@ -22,13 +22,14 @@
   	ConsoleAppender.java\
           MDC.java\
           Level.java\
  +        Logger.java\
  +	PropertyConfigurator.java\
  +	BasicConfigurator.java\
   
  -#        Logger.java\
   #        LogManager.java\
   
   #       HTMLLayout.java\
  -#	PropertyConfigurator.java\
  -#	BasicConfigurator.java\
  +
   
   ifdef $(ISJDK1)
    JSOURCES:=$(JSOURCES) RollingFileAppenderBeanInfo.java
  
  
  
  1.32      +17 -17    jakarta-log4j/src/java/org/apache/log4j/PropertyConfigurator.java
  
  Index: PropertyConfigurator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/PropertyConfigurator.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- PropertyConfigurator.java	2001/09/02 20:05:39	1.31
  +++ PropertyConfigurator.java	2001/09/02 21:40:35	1.32
  @@ -492,7 +492,7 @@
       if(value == null) 
         LogLog.debug("Could not find root category information. Is this OK?");
       else {
  -      Category root = hierarchy.getRoot();
  +      Logger root = hierarchy.getRootLogger();
         synchronized(root) {
   	parseCategory(props, root, ROOT_CATEGORY_PREFIX, INTERNAL_ROOT_NAME, 
   		      value);
  @@ -512,10 +512,10 @@
         if(key.startsWith(CATEGORY_PREFIX)) {
   	String categoryName = key.substring(CATEGORY_PREFIX.length());	
   	String value =  OptionConverter.findAndSubst(key, props);
  -	Category cat = hierarchy.getInstance(categoryName, categoryFactory);
  -	synchronized(cat) {
  -	  parseCategory(props, cat, key, categoryName, value);
  -	  parseAdditivityForCategory(props, cat, categoryName);
  +	Logger logger = hierarchy.getLogger(categoryName, categoryFactory);
  +	synchronized(logger) {
  +	  parseCategory(props, logger, key, categoryName, value);
  +	  parseAdditivityForCategory(props, logger, categoryName);
   	}
         } else if(key.startsWith(RENDERER_PREFIX)) {
   	String renderedClass = key.substring(RENDERER_PREFIX.length());	
  @@ -528,7 +528,7 @@
     /**
        Parse the additivity option for a non-root category.
      */
  -  void parseAdditivityForCategory(Properties props, Category cat,
  +  void parseAdditivityForCategory(Properties props, Logger cat,
   				  String categoryName) {
       String value = OptionConverter.findAndSubst(ADDITIVITY_PREFIX + categoryName, 
   					     props);
  @@ -545,15 +545,15 @@
     /**
        This method must work for the root category as well.
      */
  -  void parseCategory(Properties props, Category cat, String optionKey,
  -		     String catName, String value) {
  +  void parseCategory(Properties props, Logger logger, String optionKey,
  +		     String loggerName, String value) {
   
  -    LogLog.debug("Parsing for [" +catName +"] with value=[" + value+"].");
  +    LogLog.debug("Parsing for [" +loggerName +"] with value=[" + value+"].");
       // We must skip over ',' but not white space
       StringTokenizer st = new StringTokenizer(value, ",");
        
       // If value is not in the form ", appender.." or "", then we should set
  -    // the priority of the category.
  +    // the priority of the loggeregory.
       
       if(!(value.startsWith(",") || value.equals(""))) {
   
  @@ -568,17 +568,17 @@
         // null. We also check that the user has not specified inherited for the
         // root category.
         if(priorityStr.equalsIgnoreCase(BasicConfigurator.INHERITED) &&
  -                                	 !catName.equals(INTERNAL_ROOT_NAME)) {
  -	cat.setPriority(null);
  +                                	 !loggerName.equals(INTERNAL_ROOT_NAME)) {
  +	logger.setPriority(null);
         } else {
  -	cat.setLevel(OptionConverter.toLevel(priorityStr, 
  +	logger.setLevel(OptionConverter.toLevel(priorityStr, 
   					     Priority.DEBUG));
         }
  -      LogLog.debug("Category " + catName + " set to " + cat.getPriority());
  +      LogLog.debug("Category " + loggerName + " set to " + logger.getPriority());
       }
   
       // Remove all existing appenders. They will be reconstructed below.
  -    cat.removeAllAppenders();
  +    logger.removeAllAppenders();
       
       Appender appender;    
       String appenderName;
  @@ -589,7 +589,7 @@
         LogLog.debug("Parsing appender named \"" + appenderName +"\".");
         appender = parseAppender(props, appenderName);
         if(appender != null) {
  -	cat.addAppender(appender);
  +	logger.addAppender(appender);
         }      
       }          
     }
  @@ -657,6 +657,6 @@
        <code>filename</code> to reconfigure log4j. */
     public
     void doOnChange() {
  -    new PropertyConfigurator().doConfigure(filename, Category.defaultHierarchy);
  +    new PropertyConfigurator().doConfigure(filename, Logger.defaultHierarchy);
     }
   }
  
  
  
  1.4       +2 -2      jakarta-log4j/src/java/org/apache/log4j/ProvisionNode.java
  
  Index: ProvisionNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/ProvisionNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProvisionNode.java	2001/07/13 07:53:09	1.3
  +++ ProvisionNode.java	2001/09/02 21:40:35	1.4
  @@ -11,8 +11,8 @@
   
   class ProvisionNode extends Vector {
       
  -  ProvisionNode(Category cat) {
  +  ProvisionNode(Logger logger) {
       super();
  -    this.addElement(cat);
  +    this.addElement(logger);
     }
   }
  
  
  
  1.11      +1 -1      jakarta-log4j/src/java/org/apache/log4j/TTCCLayout.java
  
  Index: TTCCLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/TTCCLayout.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TTCCLayout.java	2001/09/02 20:05:39	1.10
  +++ TTCCLayout.java	2001/09/02 21:40:35	1.11
  @@ -185,7 +185,7 @@
       buf.append(' ');
   
       if(this.categoryPrefixing) {
  -      buf.append(event.categoryName);
  +      buf.append(event.loggerName);
         buf.append(' ');
       }
   
  
  
  
  1.5       +2 -2      jakarta-log4j/src/java/org/apache/log4j/examples/MyCategoryFactory.java
  
  Index: MyCategoryFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/examples/MyCategoryFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MyCategoryFactory.java	2001/02/03 22:39:22	1.4
  +++ MyCategoryFactory.java	2001/09/02 21:40:36	1.5
  @@ -7,7 +7,7 @@
   
   package org.apache.log4j.examples;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.spi.CategoryFactory;
   
   /**
  @@ -27,7 +27,7 @@
     }
   
     public
  -  Category makeNewCategoryInstance(String name) {
  +  Logger makeNewCategoryInstance(String name) {
       return new MyCategory(name);
     }
   }
  
  
  
  1.11      +1 -0      jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerCategory.java
  
  Index: AppServerCategory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerCategory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AppServerCategory.java	2001/06/26 18:28:52	1.10
  +++ AppServerCategory.java	2001/09/02 21:40:36	1.11
  @@ -11,6 +11,7 @@
   import java.net.MalformedURLException;
   
   import org.apache.log4j.Priority;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.Category;
   import org.apache.log4j.spi.CategoryFactory;
   import org.apache.log4j.spi.LoggingEvent;
  
  
  
  1.8       +3 -1      jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerCategoryFactory.java
  
  Index: AppServerCategoryFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerCategoryFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AppServerCategoryFactory.java	2001/06/25 07:06:24	1.7
  +++ AppServerCategoryFactory.java	2001/09/02 21:40:36	1.8
  @@ -6,6 +6,7 @@
   import java.net.UnknownHostException;
   
   import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.Category;
   import org.apache.log4j.spi.CategoryFactory;
   
  @@ -130,7 +131,8 @@
      *  Create a new instance of <code>AppServerCategory</code>
      *  using the information contained in this instance.
      */
  -  public Category makeNewCategoryInstance(String name) {
  +  public 
  +  Logger makeNewCategoryInstance(String name) {
       Category result = new AppServerCategory(name, hostname, server, 
   					    component, version);
       if ( messageBundle != null )
  
  
  
  1.27      +21 -21    jakarta-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java
  
  Index: OptionConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- OptionConverter.java	2001/09/02 20:05:39	1.26
  +++ OptionConverter.java	2001/09/02 21:40:36	1.27
  @@ -431,26 +431,26 @@
     public
     void selectAndConfigure(URL url, String clazz,  Hierarchy hierarchy) {
   
  -    Configurator configurator = null;
  -    String filename = url.getFile();
  -
  -    if(clazz == null && filename != null && filename.endsWith(".xml")) {
  -      clazz = "org.apache.log4j.xml.DOMConfigurator";
  -    }
  -
  -    if(clazz != null) {
  -      LogLog.debug("Preferred configurator class: " + clazz);
  -      configurator = (Configurator) instantiateByClassName(clazz, 
  -							   Configurator.class,
  -							   null);
  -      if(configurator == null) {
  -	LogLog.error("Could not instantiate configurator ["+clazz+"].");
  -	return;
  -      }
  -    } else {
  -      configurator = new PropertyConfigurator();
  -    }
  -
  -    configurator.doConfigure(url, hierarchy);
  +   Configurator configurator = null;
  +   String filename = url.getFile();
  +   
  +   if(clazz == null && filename != null && filename.endsWith(".xml")) {
  +     clazz = "org.apache.log4j.xml.DOMConfigurator";
  +   }
  +   
  +   if(clazz != null) {
  +     LogLog.debug("Preferred configurator class: " + clazz);
  +     configurator = (Configurator) instantiateByClassName(clazz, 
  +							  Configurator.class,
  +							  null);
  +     if(configurator == null) {
  +   	  LogLog.error("Could not instantiate configurator ["+clazz+"].");
  +   	  return;
  +     }
  +   } else {
  +     configurator = new PropertyConfigurator();
  +   }
  +   
  +   configurator.doConfigure(url, hierarchy);
     }
   }
  
  
  
  1.15      +1 -1      jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java
  
  Index: PatternParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PatternParser.java	2001/09/02 20:05:39	1.14
  +++ PatternParser.java	2001/09/02 21:40:36	1.15
  @@ -541,7 +541,7 @@
       }
       
       String getFullyQualifiedName(LoggingEvent event) {
  -      return event.categoryName;
  +      return event.loggerName;
       }
     }  
   }
  
  
  
  1.6       +1 -1      jakarta-log4j/src/java/org/apache/log4j/net/JMSSink.java
  
  Index: JMSSink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/JMSSink.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JMSSink.java	2001/01/05 21:08:57	1.5
  +++ JMSSink.java	2001/09/02 21:40:36	1.6
  @@ -68,7 +68,7 @@
         while(true) {
   	ObjectMessage msg = (ObjectMessage)topicSubscriber.receive();      
   	event = (LoggingEvent) msg.getObject();
  -	remoteCategory = Category.getInstance(event.categoryName);
  +	remoteCategory = Category.getInstance(event.loggerName);
   	remoteCategory.callAppenders(event);	
   	
   	// dump the JMSMessage
  
  
  
  1.11      +14 -14    jakarta-log4j/src/java/org/apache/log4j/net/SocketNode.java
  
  Index: SocketNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/SocketNode.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SocketNode.java	2001/09/02 20:05:39	1.10
  +++ SocketNode.java	2001/09/02 21:40:36	1.11
  @@ -16,7 +16,7 @@
   import java.io.ObjectInputStream;
   
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.Hierarchy;
   import org.apache.log4j.spi.LoggingEvent;
   import org.apache.log4j.Level;
  @@ -42,7 +42,7 @@
     Hierarchy hierarchy;
     ObjectInputStream ois;
   
  -  static Category cat = Category.getInstance(SocketNode.class.getName());
  +  static Logger logger = Logger.getLogger(SocketNode.class.getName());
   
     public 
     SocketNode(Socket socket, Hierarchy hierarchy) {
  @@ -52,7 +52,7 @@
         ois = new ObjectInputStream(socket.getInputStream());
       }
       catch(Exception e) {
  -      cat.error("Could not open ObjectInputStream to "+socket, e);
  +      logger.error("Could not open ObjectInputStream to "+socket, e);
       }
     }
   
  @@ -64,33 +64,33 @@
   
     public void run() {
       LoggingEvent event;
  -    Category remoteCategory;
  +    Logger remoteLogger;
   
       try {
         while(true) {	
   	event = (LoggingEvent) ois.readObject();	
  -	remoteCategory = hierarchy.getInstance(event.categoryName);
  -	event.category = remoteCategory;
  -	if(event.level.isGreaterOrEqual(remoteCategory.getChainedLevel())) {
  -	  remoteCategory.callAppenders(event);	
  +	remoteLogger = hierarchy.getLogger(event.loggerName);
  +	event.logger = remoteLogger;
  +	if(event.level.isGreaterOrEqual(remoteLogger.getChainedLevel())) {
  +	  remoteLogger.callAppenders(event);	
   	}
         }
       }
       catch(java.io.EOFException e) {
  -      cat.info("Caught java.io.EOFException closing conneciton.");
  +      logger.info("Caught java.io.EOFException closing conneciton.");
       } catch(java.net.SocketException e) {
  -      cat.info("Caught java.net.SocketException closing conneciton.");
  +      logger.info("Caught java.net.SocketException closing conneciton.");
       } catch(IOException e) {
  -      cat.info("Caught java.io.IOException: "+e);
  -      cat.info("Closing connection.");
  +      logger.info("Caught java.io.IOException: "+e);
  +      logger.info("Closing connection.");
       } catch(Exception e) {
  -      cat.error("Unexpected exception. Closing conneciton.", e);
  +      logger.error("Unexpected exception. Closing conneciton.", e);
       }
       
       try {
         ois.close();
       } catch(Exception e) {
  -      cat.info("Could not close connection.", e);	
  +      logger.info("Could not close connection.", e);	
       }  
     }
   }
  
  
  
  1.4       +2 -2      jakarta-log4j/src/java/org/apache/log4j/spi/CategoryFactory.java
  
  Index: CategoryFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/CategoryFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CategoryFactory.java	2001/07/05 19:07:17	1.3
  +++ CategoryFactory.java	2001/09/02 21:40:36	1.4
  @@ -7,7 +7,7 @@
   
   package org.apache.log4j.spi;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   
   /**
      
  @@ -24,6 +24,6 @@
   
    
     public
  -  Category makeNewCategoryInstance(String name);
  +  Logger makeNewCategoryInstance(String name);
   
   }
  
  
  
  1.3       +3 -3      jakarta-log4j/src/java/org/apache/log4j/spi/HierarchyEventListener.java
  
  Index: HierarchyEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/HierarchyEventListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HierarchyEventListener.java	2001/07/20 15:56:03	1.2
  +++ HierarchyEventListener.java	2001/09/02 21:40:36	1.3
  @@ -7,7 +7,7 @@
   
   package org.apache.log4j.spi;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.Appender;
   
   /**
  @@ -26,10 +26,10 @@
   
   
     public
  -  void addAppenderEvent(Category cat, Appender appender);
  +  void addAppenderEvent(Logger logger, Appender appender);
   
     public
  -  void removeAppenderEvent(Category cat, Appender appender);
  +  void removeAppenderEvent(Logger logger, Appender appender);
   
   
   }
  
  
  
  1.20      +14 -14    jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java
  
  Index: LoggingEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- LoggingEvent.java	2001/09/02 20:05:40	1.19
  +++ LoggingEvent.java	2001/09/02 21:40:36	1.20
  @@ -7,7 +7,7 @@
   
   package org.apache.log4j.spi;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.Level;
   import org.apache.log4j.NDC;
   import org.apache.log4j.MDC;
  @@ -42,18 +42,18 @@
   
     private static long startTime = System.currentTimeMillis();
   
  -  /** Fully qualified name of the calling category class. */
  -  transient public final String fqnOfCategoryClass;
  +  /** Fully qualified name of the calling logger class. */
  +  transient public final String fqnOfLoggerClass;
   
  -  /** The category of the logging event. The category field is not
  +  /** The logger of the logging event. The logger field is not
     serialized for performance reasons. 
   
     <p>It is set by the LoggingEvent constructor or set by a remote
     entity after deserialization. */
  -  transient public Category category;
  +  transient public Logger logger;
   
  -  /** The category name. */
  -  public final String categoryName;
  +  /** The logger name. */
  +  public final String loggerName;
     
     /** Level of logging event. Level cannot be serializable
         because it is a flyweight.  Due to its special seralization it
  @@ -117,15 +117,15 @@
        <p>Except {@link #timeStamp} all the other fields of
        <code>LoggingEvent</code> are filled when actually needed.
        <p>
  -     @param category The category of this event.
  +     @param logger The logger of this event.
        @param level The level of this event.
        @param message  The message of this event.
        @param throwable The throwable of this event.  */
  -  public LoggingEvent(String fqnOfCategoryClass, Category category, 
  +  public LoggingEvent(String fqnOfLoggerClass, Logger logger, 
   		      Level level, Object message, Throwable throwable) {
  -    this.fqnOfCategoryClass = fqnOfCategoryClass;
  -    this.category = category;
  -    this.categoryName = category.getName();
  +    this.fqnOfLoggerClass = fqnOfLoggerClass;
  +    this.logger = logger;
  +    this.loggerName = logger.getName();
       this.level = level;
       this.message = message;
       if(throwable != null) {
  @@ -143,7 +143,7 @@
     public
     LocationInfo getLocationInformation() {
       if(locationInfo == null) {
  -      locationInfo = new LocationInfo(new Throwable(), fqnOfCategoryClass);
  +      locationInfo = new LocationInfo(new Throwable(), fqnOfLoggerClass);
       }
       return locationInfo;
     }
  @@ -214,7 +214,7 @@
   	 renderedMessage = (String) message;
          else {
   	 renderedMessage=
  -            category.getHierarchy().getRendererMap().findAndRender(message);
  +            logger.getHierarchy().getRendererMap().findAndRender(message);
          }
        }
        return renderedMessage;
  
  
  
  1.3       +13 -13    jakarta-log4j/src/java/org/apache/log4j/test/FQCNTest.java
  
  Index: FQCNTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/test/FQCNTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FQCNTest.java	2001/06/27 16:02:41	1.2
  +++ FQCNTest.java	2001/09/02 21:40:36	1.3
  @@ -18,7 +18,7 @@
   */
   public class FQCNTest {
   
  -  static Category cat = Category.getInstance("dddd");
  +  //static Logger cat = Logger.getLoggerInstance("dddd");
     
     public 
     static 
  @@ -49,7 +49,7 @@
   
     static
     void test() {
  -    X1Category x1 = X1Category.getLogger("x1");
  +    X1Logger x1 = X1Logger.getX1Logger("x1");
       x1.debug("hello");    
       x1.debug1("hello");  
       x1.debug2("hello");  
  @@ -61,12 +61,12 @@
   // ==========================================================================
   // ==========================================================================
   
  -class X1Category extends Category {
  -  static String FQCN = X1Category.class.getName() + ".";
  +class X1Logger extends Logger {
  +  static String FQCN = X1Logger.class.getName() + ".";
   
  -  private static X1CategoryFactory factory = new X1CategoryFactory();
  +  private static X1LoggerFactory factory = new X1LoggerFactory();
   
  -  public X1Category(String name) {
  +  public X1Logger(String name) {
       super(name);
     }
   
  @@ -82,24 +82,24 @@
   
     protected
     String getFQCN() {
  -    return X1Category.FQCN;
  +    return X1Logger.FQCN;
     }
   
     public 
     static
  -  X1Category getLogger(String name) {
  -    return ((X1Category) Category.getInstance(name, factory)); 
  +  X1Logger getX1Logger(String name) {
  +    return ((X1Logger) Logger.getLogger(name, factory)); 
     }
   }
   
  -class X1CategoryFactory implements CategoryFactory {
  +class X1LoggerFactory implements CategoryFactory {
   
     public
  -  X1CategoryFactory() {
  +  X1LoggerFactory() {
     }
     
     public
  -  Category makeNewCategoryInstance(String name) {
  -    return new X1Category(name);
  +  Logger makeNewCategoryInstance(String name) {
  +    return new X1Logger(name);
     }
   }
  
  
  
  1.17      +1 -1      jakarta-log4j/src/java/org/apache/log4j/test/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/test/Makefile,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Makefile	2001/08/06 16:38:14	1.16
  +++ Makefile	2001/09/02 21:40:36	1.17
  @@ -19,7 +19,7 @@
    ShortSocketServer.java\
    DelayedLoop.java\
    SysoutConfigurator.java\
  - UnitTestCategory.java\
  + UnitTestLogger.java\
    UnitTestCyclicBuffer.java\
    UnitTestOR.java\
    UnitTestBoundedFIFO.java\
  
  
  
  1.1                  jakarta-log4j/src/java/org/apache/log4j/test/UnitTestLogger.java
  
  Index: UnitTestLogger.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.APL file.  */
  
  package org.apache.log4j.test;
  
  import org.apache.log4j.spi.LoggingEvent;
  import org.apache.log4j.Logger;
  import org.apache.log4j.FileAppender;
  import org.apache.log4j.BasicConfigurator;
  import org.apache.log4j.Appender;
  import org.apache.log4j.AppenderSkeleton;
  import org.apache.log4j.Level;
  import org.apache.log4j.Hierarchy;
  import org.apache.log4j.spi.RootCategory;
  
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import junit.framework.Test;
  import java.util.Enumeration;
  import java.util.ResourceBundle;
  import java.util.Locale;
  
  /**
     Used for internal unit testing the Logger class.
  
     @author Ceki G&uuml;lc&uuml;
  
  */
  public class UnitTestLogger extends TestCase {
  
    Logger cat;
    Appender a1;
    Appender a2;
  
    ResourceBundle rbUS;
    ResourceBundle rbFR; 
    ResourceBundle rbCH; 
  
    // A short message.
    static String MSG = "M";
    
  
    public UnitTestLogger(String name) {
      super(name);
    }
  
    public
    void setUp() {
      rbUS = ResourceBundle.getBundle("L7D", new Locale("en", "US"));
      assertNotNull(rbUS);
  
      rbFR = ResourceBundle.getBundle("L7D", new Locale("fr", "FR"));
      assertNotNull("Got a null resource bundle.", rbFR);
  
      rbCH = ResourceBundle.getBundle("L7D", new Locale("fr", "CH"));
      assertNotNull("Got a null resource bundle.", rbCH);
  
    }
  
    public
    void tearDown() {
      // Regular users should not use the clear method lightly!
      Logger.getDefaultHierarchy().clear();
      BasicConfigurator.resetConfiguration();
      a1 = null;
      a2 = null;
    }
  
    /**
       Add an appender and see if it can be retrieved.
    */
    public
    void testAppender1() {
      cat = Logger.getLogger("test");
      a1 = new FileAppender();
      a1.setName("testAppender1");             
      cat.addAppender(a1);
  
      Enumeration enum = cat.getAllAppenders();
      Appender aHat = (Appender) enum.nextElement();    
      assertEquals(a1, aHat);    
    }
  
    /**
       Add an appender X, Y, remove X and check if Y is the only
       remaining appender.
    */
    public
    void testAppender2() {
      a1 = new FileAppender();
      a1.setName("testAppender2.1");           
      a2 = new FileAppender();
      a2.setName("testAppender2.2");           
  
      cat = Logger.getLogger("test");
      cat.addAppender(a1);
      cat.addAppender(a2);    
      cat.removeAppender("testAppender2.1");
      Enumeration enum = cat.getAllAppenders();
      Appender aHat = (Appender) enum.nextElement();    
      assertEquals(a2, aHat);
      assert(!enum.hasMoreElements());
    }
  
    /**
       Test if logger a.b inherits its appender from a.
     */
    public
    void testAdditivity1() {
      Logger a = Logger.getLogger("a");
      Logger ab = Logger.getLogger("a.b");
      CountingAppender ca = new CountingAppender();
      a.addAppender(ca);
      
                     assertEquals(ca.counter, 0);
      ab.debug(MSG); assertEquals(ca.counter, 1);
      ab.info(MSG);  assertEquals(ca.counter, 2);
      ab.warn(MSG);  assertEquals(ca.counter, 3);
      ab.error(MSG); assertEquals(ca.counter, 4);    
      
  
    }
  
    /**
       Test multiple additivity.
  
     */
    public
    void testAdditivity2() {
      
      Logger a = Logger.getLogger("a");
      Logger ab = Logger.getLogger("a.b");
      Logger abc = Logger.getLogger("a.b.c");
      Logger x   = Logger.getLogger("x");
  
      CountingAppender ca1 = new CountingAppender();
      CountingAppender ca2 = new CountingAppender();
  
      a.addAppender(ca1);
      abc.addAppender(ca2);
  
      assertEquals(ca1.counter, 0); 
      assertEquals(ca2.counter, 0);        
      
      ab.debug(MSG);  
      assertEquals(ca1.counter, 1); 
      assertEquals(ca2.counter, 0);        
  
      abc.debug(MSG);
      assertEquals(ca1.counter, 2); 
      assertEquals(ca2.counter, 1);        
  
      x.debug(MSG);
      assertEquals(ca1.counter, 2); 
      assertEquals(ca2.counter, 1);    
    }
  
    /**
       Test additivity flag.
  
     */
    public
    void testAdditivity3() {
  
      Logger root = Logger.getRootLogger();    
      Logger a = Logger.getLogger("a");
      Logger ab = Logger.getLogger("a.b");
      Logger abc = Logger.getLogger("a.b.c");
      Logger x   = Logger.getLogger("x");
  
      CountingAppender caRoot = new CountingAppender();
      CountingAppender caA = new CountingAppender();
      CountingAppender caABC = new CountingAppender();
  
      root.addAppender(caRoot);
      a.addAppender(caA);
      abc.addAppender(caABC);
  
      assertEquals(caRoot.counter, 0); 
      assertEquals(caA.counter, 0); 
      assertEquals(caABC.counter, 0);        
      
      ab.setAdditivity(false);
  
  
      a.debug(MSG);  
      assertEquals(caRoot.counter, 1); 
      assertEquals(caA.counter, 1); 
      assertEquals(caABC.counter, 0);        
  
      ab.debug(MSG);  
      assertEquals(caRoot.counter, 1); 
      assertEquals(caA.counter, 1); 
      assertEquals(caABC.counter, 0);        
  
      abc.debug(MSG);  
      assertEquals(caRoot.counter, 1); 
      assertEquals(caA.counter, 1); 
      assertEquals(caABC.counter, 1);        
      
    }
  
  
    public
    void testDisable1() {
      CountingAppender caRoot = new CountingAppender();
      Logger root = Logger.getRootLogger();    
      root.addAppender(caRoot);
  
      Hierarchy h = Logger.getDefaultHierarchy();
      h.disableDebug();
      assertEquals(caRoot.counter, 0);     
  
      root.debug(MSG); assertEquals(caRoot.counter, 0);  
      root.info(MSG); assertEquals(caRoot.counter, 1);  
      root.log(Level.WARN, MSG); assertEquals(caRoot.counter, 2);  
      root.warn(MSG); assertEquals(caRoot.counter, 3);  
  
      h.disableInfo();
      root.debug(MSG); assertEquals(caRoot.counter, 3);  
      root.info(MSG); assertEquals(caRoot.counter, 3);  
      root.log(Level.WARN, MSG); assertEquals(caRoot.counter, 4);  
      root.error(MSG); assertEquals(caRoot.counter, 5);  
      root.log(Level.ERROR, MSG); assertEquals(caRoot.counter, 6);  
  
      h.disableAll();
      root.debug(MSG); assertEquals(caRoot.counter, 6);  
      root.info(MSG); assertEquals(caRoot.counter, 6);  
      root.log(Level.WARN, MSG); assertEquals(caRoot.counter, 6);  
      root.error(MSG); assertEquals(caRoot.counter, 6);  
      root.log(Level.FATAL, MSG); assertEquals(caRoot.counter, 6);  
      root.log(Level.FATAL, MSG); assertEquals(caRoot.counter, 6);  
  
      h.disable(Level.FATAL);
      root.debug(MSG); assertEquals(caRoot.counter, 6);  
      root.info(MSG); assertEquals(caRoot.counter, 6);  
      root.log(Level.WARN, MSG); assertEquals(caRoot.counter, 6);  
      root.error(MSG); assertEquals(caRoot.counter, 6);
      root.log(Level.ERROR, MSG); assertEquals(caRoot.counter, 6);  
      root.log(Level.FATAL, MSG); assertEquals(caRoot.counter, 6);  
    }
  
  
    public
    void testRB1() {
      Logger root = Logger.getRootLogger(); 
      root.setResourceBundle(rbUS);
      ResourceBundle t = root.getResourceBundle();
      assertSame(t, rbUS);
  
      Logger x = Logger.getLogger("x");
      Logger x_y = Logger.getLogger("x.y");
      Logger x_y_z = Logger.getLogger("x.y.z");
  
      t = x.getResourceBundle();     assertSame(t, rbUS);
      t = x_y.getResourceBundle();   assertSame(t, rbUS);
      t = x_y_z.getResourceBundle(); assertSame(t, rbUS);
    }
  
    public
    void testRB2() {
      Logger root = Logger.getRootLogger(); 
      root.setResourceBundle(rbUS);
      ResourceBundle t = root.getResourceBundle();
      assertSame(t, rbUS);
  
      Logger x = Logger.getLogger("x");
      Logger x_y = Logger.getLogger("x.y");
      Logger x_y_z = Logger.getLogger("x.y.z");
  
      x_y.setResourceBundle(rbFR);
      t = x.getResourceBundle();     assertSame(t, rbUS);
      t = x_y.getResourceBundle();   assertSame(t, rbFR);
      t = x_y_z.getResourceBundle(); assertSame(t, rbFR);    
    }
  
  
    public
    void testRB3() {
      Logger root = Logger.getRootLogger(); 
      root.setResourceBundle(rbUS);
      ResourceBundle t = root.getResourceBundle();
      assertSame(t, rbUS);
  
      Logger x = Logger.getLogger("x");
      Logger x_y = Logger.getLogger("x.y");
      Logger x_y_z = Logger.getLogger("x.y.z");
  
      x_y.setResourceBundle(rbFR);
      x_y_z.setResourceBundle(rbCH);
      t = x.getResourceBundle();     assertSame(t, rbUS);
      t = x_y.getResourceBundle();   assertSame(t, rbFR);
      t = x_y_z.getResourceBundle(); assertSame(t, rbCH);    
    }
  
    public
    void testExists() {
      Logger a = Logger.getLogger("a");
      Logger a_b = Logger.getLogger("a.b");
      Logger a_b_c = Logger.getLogger("a.b.c");
      
      Logger t;
      t = Logger.exists("xx");    assertNull(t);
      t = Logger.exists("a");     assertSame(a, t);
      t = Logger.exists("a.b");   assertSame(a_b, t);
      t = Logger.exists("a.b.c"); assertSame(a_b_c, t);
    }
  
    public
    void testHierarchy1() {
      Hierarchy h = new Hierarchy( new RootCategory(Level.ERROR));
      Logger a0 = h.getLogger("a");
      assertEquals("a", a0.getName());
      assertNull(a0.getLevel());
      assertSame(Level.ERROR, a0.getChainedLevel());
  
      Logger a1 = h.getLogger("a");
      assertSame(a0, a1);
  
      
  
      
    }
  
    public
    static
    Test suite() {
      TestSuite suite = new TestSuite();
      suite.addTest(new UnitTestLogger("testAppender1"));
      suite.addTest(new UnitTestLogger("testAppender2"));
      suite.addTest(new UnitTestLogger("testAdditivity1"));        
      suite.addTest(new UnitTestLogger("testAdditivity2"));        
      suite.addTest(new UnitTestLogger("testAdditivity3"));        
      suite.addTest(new UnitTestLogger("testDisable1"));        
      suite.addTest(new UnitTestLogger("testRB1"));        
      suite.addTest(new UnitTestLogger("testRB2"));        
      suite.addTest(new UnitTestLogger("testRB3"));        
      suite.addTest(new UnitTestLogger("testExists"));        
      suite.addTest(new UnitTestLogger("testHierarchy1"));        
      return suite;
    }
  
  
    static private class CountingAppender extends AppenderSkeleton {
  
      int counter;
  
      CountingAppender() {
        counter = 0;
      }
      public void close() {
      }
  
      public
      void append(LoggingEvent event) {
        counter++;
      }
      
      public 
      boolean requiresLayout() {
        return true;
      }
    }
  }
  
  
  
  1.30      +11 -10    jakarta-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java
  
  Index: DOMConfigurator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DOMConfigurator.java	2001/09/02 20:05:40	1.29
  +++ DOMConfigurator.java	2001/09/02 21:40:36	1.30
  @@ -14,6 +14,7 @@
   import org.w3c.dom.*;
   import java.lang.reflect.Method;
   import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.spi.OptionHandler;
   import org.apache.log4j.spi.ErrorHandler;
   import org.apache.log4j.spi.AppenderAttachable;
  @@ -287,14 +288,14 @@
       // Create a new org.apache.log4j.Category object from the <category> element.
       String catName = subst(categoryElement.getAttribute(NAME_ATTR));
   
  -    Category cat;    
  +    Logger cat;    
   
       String className = subst(categoryElement.getAttribute(CLASS_ATTR));
   
   
       if(EMPTY_STR.equals(className)) {
         LogLog.debug("Retreiving an instance of org.apache.log4j.Category.");
  -      cat = hierarchy.getInstance(catName);
  +      cat = hierarchy.getLogger(catName);
       }
       else {
         LogLog.debug("Desired category sub-class: ["+className+']');
  @@ -366,7 +367,7 @@
     */
     protected
     void parseRoot (Element rootElement, Hierarchy hierarchy) {
  -    Category root = hierarchy.getRoot();
  +    Logger root = hierarchy.getRootLogger();
       // category configuration needs to be atomic
       synchronized(root) {    
         parseChildrenOfCategoryElement(rootElement, root, true);
  @@ -379,7 +380,7 @@
     */
     protected
     void parseChildrenOfCategoryElement(Element catElement,
  -				      Category cat, boolean isRoot) {
  +				      Logger cat, boolean isRoot) {
       
       PropertySetter propSetter = new PropertySetter(cat);
       
  @@ -467,8 +468,8 @@
        Used internally to parse a level  element.
     */
     protected
  -  void parseLevel(Element element, Category cat, boolean isRoot) {
  -    String catName = cat.getName();
  +  void parseLevel(Element element, Logger logger, boolean isRoot) {
  +    String catName = logger.getName();
       if(isRoot) {
         catName = "root";
       }
  @@ -480,13 +481,13 @@
         if(isRoot) {
   	LogLog.error("Root level cannot be inherited. Ignoring directive.");
         } else {
  -	cat.setLevel(null);
  +	logger.setLevel(null);
         }
       } else {
         String className = subst(element.getAttribute(CLASS_ATTR));      
         if(EMPTY_STR.equals(className)) {      
   	
  -	cat.setLevel(Level.toLevel(priStr));
  +	logger.setLevel(Level.toLevel(priStr));
         } else {
   	LogLog.debug("Desired Level sub-class: ["+className+']');
   	try {	 
  @@ -495,7 +496,7 @@
   						    ONE_STRING_PARAM);
   	  Level pri = (Level) toLevelMethod.invoke(null, 
   						    new Object[] {priStr});
  -	  cat.setLevel(pri);
  +	  logger.setLevel(pri);
   	} catch (Exception oops) {
   	  LogLog.error("Could not create level ["+priStr+
   		       "]. Reported error follows.", oops);
  @@ -503,7 +504,7 @@
   	}
         }
       }
  -    LogLog.debug(catName + " level set to " + cat.getLevel());    
  +    LogLog.debug(catName + " level set to " + logger.getLevel());    
     }
   
     protected
  
  
  
  1.15      +1 -1      jakarta-log4j/src/java/org/apache/log4j/xml/XMLLayout.java
  
  Index: XMLLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/XMLLayout.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XMLLayout.java	2001/09/02 20:05:40	1.14
  +++ XMLLayout.java	2001/09/02 21:40:36	1.15
  @@ -140,7 +140,7 @@
       // We yield to the \r\n heresy.
   
       buf.append("<log4j:event category=\"");
  -    buf.append(event.categoryName);
  +    buf.append(event.loggerName);
       buf.append("\" timestamp=\"");
       buf.append(event.timeStamp);
       buf.append("\" level=\"");
  
  
  
  1.15      +2 -1      jakarta-log4j/src/java/org/apache/log4j/xml/examples/XCategory.java
  
  Index: XCategory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/examples/XCategory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XCategory.java	2001/09/02 20:05:40	1.14
  +++ XCategory.java	2001/09/02 21:40:36	1.15
  @@ -9,6 +9,7 @@
   
   
   import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.Level;
   import org.apache.log4j.spi.OptionHandler;
   import org.apache.log4j.spi.LoggingEvent;
  @@ -183,7 +184,7 @@
       }
   
       public
  -    Category makeNewCategoryInstance(String name) {
  +    Logger  makeNewCategoryInstance(String name) {
         return new XCategory(name);
       }
     }
  
  
  

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