logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "T Master" <tmas...@iknowledgeinc.com>
Subject org.apache.log4j.helpers.AppenderAttachableImpl.addAppender(Appender newAppender)
Date Wed, 09 Jan 2002 21:57:43 GMT
Ceki,

I've been looking at the code for adding an Appender.

1.  In Log4J config files (i use properties), appenders must have a _unique_
name as I understand it.

2.  In Log4J system, appenders are _not_ required to have a name for
instantiation - the name is null by default.

3.  I've noticed in
org.apache.log4j.helpers.AppenderAttachableImpl.addAppender(Appender
newAppender) the code:
   //@since version 0.9.1
    if(!appenderList.contains(newAppender))
      appenderList.addElement(newAppender);

   This will check if the Vector appenderList has the same Appender by
equality ( the equals() is used).
   However, neither AppenderSkeleton, or WriterAppender or FileAppender  or
RollingFileAppender
(the object i was using) implements the equals() method.

  In my opinion, each and every non-abstract Appender should implement
public boolean equals().
  The following should be tested for equality:
     - object reference, null, then the appender's name.


   I could be talking absolute rubbish, but I noticed one of my Category
objects had two RollingFileAppenders with the same name in it,
 produced from the following code:
    CODE:
          Enumeration enum = category.getAllAppenders();
          while (enum.hasMoreElements())
          {
               Appender appender = (Appender) enum.nextElement();
               System.out.println("category has -" + appender.getName()
+".");
           }
    OUTPUT:
        category has -FILE_DEST.
        category has -FILE_DEST.

Forgive me for babbling, or being mistaken.


T Master



--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message