You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/05/09 20:37:57 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/xml/test DOMTest.java

ceki        2004/05/09 11:37:57

  Modified:    src/java/org/apache/log4j/spi LoggingEventFieldResolver.java
                        LoggerRepository.java LoggingEvent.java
               src/java/org/apache/log4j Hierarchy.java MDC.java
                        AsyncAppender.java Category.java
               src/java/org/apache/log4j/pattern
                        RelativeTimePatternConverter.java
                        DatePatternConverter.java
                        PropertiesPatternConverter.java PatternParser.java
               src/java/org/apache/log4j/chainsaw
                        ChainsawCyclicBufferTableModel.java
                        ChainsawAppenderHandler.java ColumnComparator.java
               .        build.xml
               src/java/org/apache/log4j/test MDCStress.java
                        PatternTest.java CategoryWrapper.java FQCNTest.java
               src/java/org/apache/log4j/helpers DateLayout.java
               tests/src/java/org/apache/log4j/net
                        SocketServerTestCase.java
               src/java/org/apache/log4j/db/dialect mysql.sql oracle.sql
                        postgresql.sql
               src/java/org/apache/log4j/nt/test NTMin.java
               src/java/org/apache/log4j/lf5 LF5Appender.java
               tests/src/java/org/apache/log4j/helpers
                        BoundedFIFOTestCase.java CyclicBufferTestCase.java
               src/java/org/apache/log4j/net/test SMTPMin.java
                        SocketMin.java SyslogMin.java
               src/java/org/apache/log4j/xml XMLLayout.java
               src/java/org/apache/log4j/chainsaw/receivers
                        ReceiversTreeModel.java
               src/java/org/apache/log4j/chainsaw/layout
                        EventDetailLayout.java
               src/java/org/apache/log4j/xml/test DOMTest.java
  Removed:     src/java/org/apache/log4j/pattern MDCPatternConverter.java
  Log:
  - Added a properties map to LoggerRepository
  - Merged MDC properties and LoggerRepository properties into a single
  property map in LoggingEvent. As such, the MDC related get/set
   properties methods have been removed.
  - All fields of LoggingEvent now have setters. The complicated 
  constructors required to create a LoggingEvent in one shot are now deprecated.
  
  Revision  Changes    Path
  1.6       +1 -1      logging-log4j/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java
  
  Index: LoggingEventFieldResolver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LoggingEventFieldResolver.java	26 Mar 2004 16:43:23 -0000	1.5
  +++ LoggingEventFieldResolver.java	9 May 2004 18:37:55 -0000	1.6
  @@ -151,7 +151,7 @@
       } else if (EXCEPTION_FIELD.equals(upperField)) {
         return (event.getThrowableStrRep() == null ? EMPTY_STRING : getExceptionMessage(event.getThrowableStrRep()));
       } else if (TIMESTAMP_FIELD.equals(upperField)) {
  -      return new Long(event.timeStamp);
  +      return new Long(event.getTimeStamp());
       } else if (THREAD_FIELD.equals(upperField)) {
         return event.getThreadName();
       } else if (upperField.startsWith(MDC_FIELD)) {
  
  
  
  1.17      +19 -0     logging-log4j/src/java/org/apache/log4j/spi/LoggerRepository.java
  
  Index: LoggerRepository.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/LoggerRepository.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- LoggerRepository.java	4 May 2004 19:04:37 -0000	1.16
  +++ LoggerRepository.java	9 May 2004 18:37:56 -0000	1.17
  @@ -20,6 +20,7 @@
   import org.apache.log4j.plugins.PluginRegistry;
   
   import java.util.Enumeration;
  +import java.util.Map;
   
   
   /**
  @@ -168,5 +169,23 @@
      * @since 1.3
      */
     public PluginRegistry getPluginRegistry();
  +
  +  /** 
  +   * Get the properties specific for this repository.
  +   * @since 1.3
  +   */
  +  public Map getProperties();
  +
  +  /** 
  +   * Get the property of this repository.
  +   * @since 1.3
  +   */
  +  public String getProperty(String key);
  +
  +  /** 
  +   * Set a property of this repository.
  +   * @since 1.3
  +   */
  +  public void setProperty(String key, String value);
     
   }
  
  
  
  1.52      +392 -264  logging-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java
  
  Index: LoggingEvent.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- LoggingEvent.java	28 Apr 2004 18:01:03 -0000	1.51
  +++ LoggingEvent.java	9 May 2004 18:37:56 -0000	1.52
  @@ -19,14 +19,15 @@
   import java.io.ObjectOutputStream;
   import java.lang.reflect.Method;
   import java.util.Collections;
  +import java.util.HashMap;
   import java.util.Hashtable;
  +import java.util.Map;
   import java.util.Set;
   
  -import org.apache.log4j.Category;
   import org.apache.log4j.Level;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.MDC;
   import org.apache.log4j.NDC;
  -import org.apache.log4j.Priority;
   import org.apache.log4j.helpers.Loader;
   import org.apache.log4j.helpers.LogLog;
   
  @@ -51,30 +52,30 @@
    */
   public class LoggingEvent
          implements java.io.Serializable {
  -  private static long startTime = System.currentTimeMillis(  );
  +  private static long startTime = System.currentTimeMillis();
   
     // Serialization
     static final long serialVersionUID = -868428216207166145L;
  -  static final Integer[] PARAM_ARRAY = new Integer[ 1 ];
  +  static final Integer[] PARAM_ARRAY = new Integer[1];
     static final String TO_LEVEL = "toLevel";
     static final Class[] TO_LEVEL_PARAMS = new Class[] { int.class };
  -  static final Hashtable methodCache = new Hashtable( 3 );    // use a tiny table
  +  static final Hashtable methodCache = new Hashtable(3);    // use a tiny table
   
  -  
     /**
  -   * LoggingEvent are stamped with a {@link #sequenceNumber}. The 
  +   * LoggingEvent are stamped with a {@link #sequenceNumber}. The
      * <code>sequenceCount</code> static variable keeps track of the current count.
  -   * 
  +   *
      * The count starts at 1 (one).
  -   * 
  +   *
      * @since 1.3
      */
     static long sequenceCount = 1;
   
     /**
  -   * Fully qualified name of the calling category class.
  +   * Fully qualified name of the calling category class. This field does not
  +   * survive serialization.
      */
  -  public final transient String fqnOfCategoryClass;
  +  transient String fqnOfLoggerClass;
   
     /**
      * The category of the logging event. This field is not serialized for
  @@ -88,18 +89,25 @@
      * @deprecated This field will be marked as private or be completely removed
      *             in future releases. Please do not use it.
      */
  -  private transient Category logger;
  +  private transient Logger logger;
  +
  +  /**
  +   * The LoggerRepository in which this event was created.
  +   *
  +   * @since 1.3
  +   */
  +  private transient LoggerRepository loggerRepository;
   
     /**
      * <p>
  -   * The category (logger) name.
  +   * The logger name.
      * </p>
      *
      * @deprecated This field will be marked as private in future releases.
      *             Please do not access it directly. Use the {@link
      *             #getLoggerName} method instead.
      */
  -  public final String categoryName;
  +  private String loggerName;
   
     /**
      * Level of logging event. Level cannot be serializable because it is a
  @@ -111,11 +119,8 @@
      * #getLevel} method instead.
      * </p>
      *
  -   * @deprecated This field will be marked as private in future releases.
  -   *             Please do not access it directly. Use the {@link #getLevel}
  -   *             method instead.
      */
  -  public transient Priority level;
  +  private transient Level level;
   
     /**
      * The nested diagnostic context (NDC) of logging event.
  @@ -123,16 +128,16 @@
     private String ndc;
   
     /**
  -   * The mapped diagnostic context (MDC) of logging event.
  -   */
  -  private Hashtable mdcCopy;
  -
  -  /**
  -   * A map of String keys and String values.
  +   * <p>The properties map is specific for this event.</p> 
  +   * 
  +   * <p>When serialized, it contains a copy of MDC properties as well
  +   * as LoggerRepository properties.
  +   * </p>
      *
  +   * <p>It survives serialization.</p>
      * @since 1.3
      */
  -  private Hashtable properties;
  +  private Map properties;
   
     /**
      * Have we tried to do an NDC lookup? If we did, there is no need to do it
  @@ -143,13 +148,6 @@
     private boolean ndcLookupRequired = true;
   
     /**
  -   * Have we tried to do an MDC lookup? If we did, there is no need to do it
  -   * again.  Note that its value is always false when serialized. See also
  -   * the getMDC and getMDCCopy methods.
  -   */
  -  private boolean mdcCopyLookupRequired = true;
  -
  -  /**
      * The application supplied message of logging event.
      */
     private transient Object message;
  @@ -174,23 +172,32 @@
      * The number of milliseconds elapsed from 1/1/1970 until logging event was
      * created.
      */
  -  public long timeStamp;
  +  private long timeStamp;
   
     /**
  -   * 
  -   * Each logging event bears a sequence number. 
  -   * 
  +   *
  +   * Each logging event bears a sequence number.
  +   *
      * @since 1.3
      */
     long sequenceNumber;
  -  
  -  
  +
     /**
      * Location information for the caller.
      */
     private LocationInfo locationInfo;
   
     /**
  +   * The no-argument constructor for LoggingEvent. This method is the recommended
  +   * constructor for creating LoggingEvent instances.
  +   *
  +   * @since 1.3
  +   */
  +  public LoggingEvent() {
  +  }
  +
  +
  +  /**
      * Instantiate a LoggingEvent from the supplied parameters.
      *
      * <p>
  @@ -205,19 +212,18 @@
      * @param message The message of this event.
      * @param throwable The throwable of this event.
      */
  -  public LoggingEvent( String fqnOfCategoryClass, Category logger, 
  -                       Priority priority, Object message, Throwable throwable ) {
  -    this.fqnOfCategoryClass = fqnOfCategoryClass;
  +  public LoggingEvent(String fqnOfLoggerClass, Logger logger, Level level, Object message, Throwable throwable) {
  +    this.fqnOfLoggerClass = fqnOfLoggerClass;
       this.logger = logger;
  -    this.categoryName = logger.getName(  );
  -    this.level = priority;
  +    this.loggerName = logger.getName();
  +    this.level = level;
       this.message = message;
   
  -    if ( throwable != null ) {
  -      this.throwableInfo = new ThrowableInformation( throwable );
  +    if (throwable != null) {
  +      this.throwableInfo = new ThrowableInformation(throwable);
       }
   
  -    timeStamp = System.currentTimeMillis(  );
  +    timeStamp = System.currentTimeMillis();
       sequenceNumber = sequenceCount++;
     }
   
  @@ -238,16 +244,16 @@
      * @param message The message of this event.
      * @param throwable The throwable of this event.
      */
  -  public LoggingEvent( String fqnOfCategoryClass, Category logger, long timeStamp, 
  -                       Priority priority, Object message, Throwable throwable ) {
  -    this.fqnOfCategoryClass = fqnOfCategoryClass;
  +  public LoggingEvent(String fqnOfCategoryClass, Logger logger, long timeStamp, Level level, Object message,
  +    Throwable throwable) {
  +    this.fqnOfLoggerClass = fqnOfCategoryClass;
       this.logger = logger;
  -    this.categoryName = logger.getName(  );
  -    this.level = priority;
  +    this.loggerName = logger.getName();
  +    this.level = level;
       this.message = message;
   
  -    if ( throwable != null ) {
  -      this.throwableInfo = new ThrowableInformation( throwable );
  +    if (throwable != null) {
  +      this.throwableInfo = new ThrowableInformation(throwable);
       }
   
       this.timeStamp = timeStamp;
  @@ -257,119 +263,60 @@
     /**
      * Alternate constructor to allow a string array to be passed in as the throwable.
      */
  -  public LoggingEvent( String fqnOfCategoryClass, Category logger, long timeStamp, Priority priority,
  -    String threadName, Object message, String ndc, Hashtable mdc, String[] throwableStrRep, LocationInfo li,
  -    Hashtable properties ) {
  +  public LoggingEvent(String fqnOfCategoryClass, Logger logger, long timeStamp, Level level, String threadName,
  +    Object message, String ndc, Hashtable properties, String[] throwableStrRep, LocationInfo li) {
       ndcLookupRequired = false;
  -    mdcCopyLookupRequired = false;
       this.logger = logger;
  -    this.categoryName = logger.getName(  );
  -    this.level = priority;
  +    this.loggerName = logger.getName();
  +    this.level = level;
       this.message = message;
   
  -    if ( throwableStrRep != null ) {
  -      this.throwableInfo = new ThrowableInformation( throwableStrRep );
  +    if (throwableStrRep != null) {
  +      this.throwableInfo = new ThrowableInformation(throwableStrRep);
       }
       this.locationInfo = li;
  -    this.fqnOfCategoryClass = fqnOfCategoryClass;
  +    this.fqnOfLoggerClass = fqnOfCategoryClass;
       this.timeStamp = timeStamp;
       this.threadName = threadName;
       this.ndc = ndc;
  -    this.mdcCopy = mdc;
       this.properties = properties;
     }
   
  -  public boolean equals( Object rObject ) {
  -    if ( this == rObject ) {
  +  /**
  +   * Two events are considerd equal if they refer to the same instance, or if
  +   * both their timestamps and sequence numbers match.
  +   */
  +  public boolean equals(Object rObject) {
  +    if (this == rObject) {
         return true;
       }
   
  -    if ( ! ( rObject instanceof LoggingEvent ) ) {
  +    if (! (rObject instanceof LoggingEvent)) {
         return false;
       }
   
       LoggingEvent rEvent = (LoggingEvent)rObject;
   
  -    if ( timeStamp != rEvent.timeStamp ) {
  -      return false;
  -    }
  -    
  -    if ( sequenceNumber != rEvent.sequenceNumber ) {
  -      return false;
  -    }
  -
  -    // TODO: the rest of the tests could be skipped and we could just return true.
  -    
  -    
  -    // level cannot be null
  -    if ( level != rEvent.level ) {
  -      return false;
  -    }
  -
  -    // threadName can be null after all
  -    if ( threadName == null ) {
  -      if ( rEvent.threadName != null ) {
  -        return false;
  -      }
  -    } else if ( ! threadName.equals( rEvent.threadName ) ) {
  -      return false;
  -    }
  -
  -    if ( message == null ) {
  -      if ( rEvent.message != null ) {
  -        return false;
  -      }
  -    } else if ( ! message.equals( rEvent.message ) ) {
  -      return false;
  -    }
  -
  -    if ( properties == null ) {
  -      if ( rEvent.message != null ) {
  -        return false;
  -      }
  -    } else if ( ! properties.equals( rEvent.properties ) ) {
  +    if (timeStamp != rEvent.timeStamp) {
         return false;
       }
   
  -    if ( mdcCopy == null ) {
  -      if ( rEvent.mdcCopy != null ) {
  -        return false;
  -      }
  -    } else if ( ! mdcCopy.equals( rEvent.mdcCopy ) ) {
  +    if (sequenceNumber != rEvent.sequenceNumber) {
         return false;
       }
   
  -    if ( ndc == null ) {
  -      if ( rEvent.ndc != null ) {
  -        return false;
  -      }
  -    } else if ( ! ndc.equals( rEvent.ndc ) ) {
  -      return false;
  -    }
  -
  -    if ( throwableInfo == null ) {
  -      if ( rEvent.throwableInfo != null ) {
  -        return false;
  -      }
  -    } else if ( ! throwableInfo.equals( rEvent.throwableInfo ) ) {
  -      return false;
  -    }
  -
  -    if ( locationInfo == null ) {
  -      if ( rEvent.locationInfo != null ) {
  -        return false;
  -      }
  -    } else if ( ! locationInfo.equals( rEvent.locationInfo ) ) {
  -      return false;
  -    }
  -
  -    // we can now safely assume that the two events are equal.
  +    // If both the timestamp and the sequenceNumber are equal than the objects
  +    // are assumed to be equal.
       return true;
     }
   
   
  -  public int hashCode(  ) {
  -    return (int)( ( timeStamp & 0xFFFFFFFF ) ^ ( timeStamp >> 16 ) );
  +  /**
  +   * The hashcode is computed as XOR of the lower 32 bits of sequenceNumber and
  +   * the higher 32 bits of timeStamp;
  +   */
  +  public int hashCode() {
  +    return (int)( (timeStamp >> 32) ^ (sequenceNumber & 0xFFFFFFFF) );
     }
   
   
  @@ -377,8 +324,8 @@
      * Check for the existence of location information without creating it (a byproduct of calling
      * getLocationInformation).
      */
  -  public boolean locationInformationExists(  ) {
  -    return ( locationInfo != null );
  +  public boolean locationInformationExists() {
  +    return (locationInfo != null);
     }
   
   
  @@ -386,9 +333,9 @@
      * Set the location information for this logging event. The collected
      * information is cached for future use.
      */
  -  public LocationInfo getLocationInformation(  ) {
  -    if ( locationInfo == null ) {
  -      locationInfo = new LocationInfo( new Throwable(  ), fqnOfCategoryClass );
  +  public LocationInfo getLocationInformation() {
  +    if (locationInfo == null) {
  +      locationInfo = new LocationInfo(new Throwable(), fqnOfLoggerClass);
       }
   
       return locationInfo;
  @@ -396,20 +343,85 @@
   
   
     /**
  -   * Return the level of this event. Use this form instead of directly
  -   * accessing the <code>level</code> field.
  +   * Return the level of this event. 
      */
  -  public Level getLevel(  ) {
  +  public Level getLevel() {
       return (Level)level;
     }
   
  +  /**
  +   * Set the level of this event. The level can be set at most once.
  +   * 
  +   * @param level The level to set.
  +   * @throws IllegalStateException if the level has been already set.
  +   * @since 1.3
  +   */
  +  public void setLevel(Level level) {
  +    if(this.level != null) {
  +      throw new IllegalStateException("The level has been already set for this event.");
  +    }
  +    this.level = level;
  +  }
  +
   
     /**
  -   * Return the name of the logger. Use this form instead of directly
  -   * accessing the <code>categoryName</code> field.
  +   * Returns the logger of this event. May be null because events after
  +   * serialization do not have a logger.
  +   *
  +   * @since 1.3
  +   **/
  +  public Logger getLogger() {
  +    return logger;
  +  }
  +
  +
  +  /**
  +   * Set the logger of this event. Calling this method also sets the <code>loggerName</code> 
  +   * for the event. The logger can be set at most once.
  +   * 
  +   * Moreover, if the loggerName has been already set, this method will throw
  +   * an {@link IllegalStateException}.
  +   * 
  +   * @throws IllegalStateException
      */
  -  public String getLoggerName(  ) {
  -    return categoryName;
  +  public void setLogger(Logger logger) {
  +    if(this.logger != null) {
  +      throw new IllegalStateException("logger has been already set to [" 
  +          + this.logger.getName() + "].");
  +    }
  +    
  +    if(this.loggerName != null) {
  +      throw new IllegalStateException("loggerName has been already set to [" 
  +          + this.loggerName + "], logger "+logger.getName()+"] is invalid");
  +    }
  +    
  +    this.logger = logger;
  +    this.loggerName = logger.getName();
  +  }
  +
  +
  +  /**
  +   * Return the name of the logger. 
  +   */
  +  public String getLoggerName() {
  +    return loggerName;
  +  }
  +
  +
  +  /**
  +   * Set the loggerName for this event. The loggerName can be set at most once.
  +   * 
  +   * @param loggerName The loggerName to set.
  +   * @throws IllegalStateException if loggerName is already set
  +   * @since 1.3
  +   */
  +  public void setLoggerName(String loggerName) throws IllegalStateException {
  +    if (this.loggerName != null) {
  +      throw new IllegalStateException("loggerName has been already set to [" 
  +          + this.loggerName + "].");
  +    } else {
  +      this.loggerName = loggerName;
  +    }
     }
   
   
  @@ -425,14 +437,30 @@
      *
      * @since 1.1
      */
  -  public Object getMessage(  ) {
  -    if ( message != null ) {
  +  public Object getMessage() {
  +    if (message != null) {
         return message;
       } else {
  -      return getRenderedMessage(  );
  +      return getRenderedMessage();
       }
     }
   
  +  /**
  +   * Set the message for this event. The 
  +   * @param message The message to set.
  +   * @since 1.3
  +   */
  +  public void setMessage(Object message) {
  +    if(this.message != null) {
  +      throw new IllegalStateException("The message for this event has been set alredy.");
  +    }
  +    // After serialisation, message will be null and renderedMessage will be non-null. 
  +    if(this.renderedMessage != null) {
  +      throw new IllegalStateException("The message cannot be set if the renderedMessage has been set.");
  +    }
  +    this.message = message;
  +  }
  +
   
     /**
      * This method returns the NDC for this event. It will return the correct
  @@ -440,10 +468,10 @@
      * a different machine. The {@link NDC#get} method should <em>never</em> be
      * called directly.
      */
  -  public String getNDC(  ) {
  -    if ( ndcLookupRequired ) {
  +  public String getNDC() {
  +    if (ndcLookupRequired) {
         ndcLookupRequired = false;
  -      ndc = NDC.get(  );
  +      ndc = NDC.get();
       }
   
       return ndc;
  @@ -463,20 +491,19 @@
      * are searched.
      * </p>
      */
  -  public Object getMDC( String key ) {
  +  public Object XXgetMDC(String key) {
       Object r;
   
  -    // Note the mdcCopy is used if it exists. Otherwise we use the MDC
  -    // that is associated with the thread.
  -    if ( mdcCopy != null ) {
  -      r = mdcCopy.get( key );
  -
  -      if ( r != null ) {
  -        return r;
  -      }
  -    }
  -
  -    return MDC.get( key );
  +//    // Note the mdcCopy is used if it exists. Otherwise we use the MDC
  +//    // that is associated with the thread.
  +//    if ( mdcCopy != null ) {
  +//      r = mdcCopy.get( key );
  +//
  +//      if ( r != null ) {
  +//        return r;
  +//      }
  +//    }
  +    return MDC.get(key);
     }
   
   
  @@ -487,18 +514,19 @@
      * @return Set an unmodifiable set of the MDC keys.
      * @since 1.3
      */
  -  public Set getMDCKeySet(  ) {
  -    if ( mdcCopy != null ) {
  -      return Collections.unmodifiableSet( mdcCopy.keySet(  ) );
  -    } else {
  -      Hashtable t = (Hashtable)MDC.getContext(  );
  -
  -      if ( t != null ) {
  -        return Collections.unmodifiableSet( t.keySet(  ) );
  -      } else {
  -        return Collections.EMPTY_SET;
  -      }
  -    }
  +  public Set XXgetMDCKeySet() {
  +//    if ( mdcCopy != null ) {
  +//      return Collections.unmodifiableSet( mdcCopy.keySet(  ) );
  +//    } else {
  +//      Hashtable t = (Hashtable)MDC.getContext(  );
  +//
  +//      if ( t != null ) {
  +//        return Collections.unmodifiableSet( t.keySet(  ) );
  +//      } else {
  +//        return Collections.EMPTY_SET;
  +//      }
  +//    }
  +    return null;
     }
   
   
  @@ -506,32 +534,64 @@
      * Obtain a copy of this thread's MDC prior to serialization or asynchronous
      * logging.
      */
  -  public void getMDCCopy(  ) {
  -    if ( mdcCopyLookupRequired ) {
  -      mdcCopyLookupRequired = false;
  -
  -      // the clone call is required for asynchronous logging.
  -      // See also bug #5932.
  -      Hashtable t = (Hashtable)MDC.getContext(  );
  +  public void xgetMDCCopy() {
  +//    if ( mdcCopyLookupRequired ) {
  +//      mdcCopyLookupRequired = false;
  +//
  +//      // the clone call is required for asynchronous logging.
  +//      // See also bug #5932.
  +//      Hashtable t = (Hashtable)MDC.getContext(  );
  +//
  +//      if ( t != null ) {
  +//        mdcCopy = (Hashtable)t.clone(  );
  +//      }
  +//    }
  +  }
   
  -      if ( t != null ) {
  -        mdcCopy = (Hashtable)t.clone(  );
  +
  +  /**
  +   * This method creates a new properties map containing a copy of MDC context
  +   * and a copy if the properites in LoggerRepository containing the logger for
  +   * this event.
  +   * @sicne 1.3
  +   */
  +  public void createProperties() {
  +    if (properties == null) {
  +      properties = new HashMap();
  +      properties.putAll(MDC.getContext());
  +      if(logger != null) {
  +        properties.putAll(logger.getLoggerRepository().getProperties());  
         }
       }
     }
   
   
     /**
  -   * Return a previously set property. The return value can be null.
  -   *
  +   * Return a property for this event. The return value can be null.
  +   * 
  +   * <p>The property is searched first in the properties map specific for this
  +   * event, then in the MDC, then in the logger repository containing the logger
  +   * of this event.
      * @since 1.3
      */
  -  public String getProperty( String key ) {
  -    if ( properties == null ) {
  -      return null;
  -    } else {
  -      return (String)properties.get( key );
  +  public String getProperty(String key) {
  +    String value = null;
  +    if (properties != null) {
  +      value = (String) properties.get(key);
  +      if(value != null) {
  +        return value;
  +      }
  +    } else { // properties is null
  +      value = MDC.get(key);
  +      if(value != null) {
  +        return value;
  +      }
  +      
  +      if(logger != null) {
  +         value = logger.getLoggerRepository().getProperty(key);
  +      }
       }
  +    return value;
     }
   
   
  @@ -543,27 +603,34 @@
      * @return Set an unmodifiable set of the property keys.
      * @since 1.3
      */
  -  public Set getPropertyKeySet(  ) {
  -    if ( properties != null ) {
  -      return Collections.unmodifiableSet( properties.keySet(  ) );
  -    } else {
  -      return Collections.EMPTY_SET;
  +  public Set getPropertyKeySet() {
  +    if (properties == null) {
  +      createProperties();
       }
  +    return Collections.unmodifiableSet(properties.keySet());
     }
   
   
  -  public String getRenderedMessage(  ) {
  -    if ( ( renderedMessage == null ) && ( message != null ) ) {
  -      if ( message instanceof String ) {
  +  /**
  +   * Returns the rendered version of the message according to the renderers
  +   * registered in the logger repository.
  +   *
  +   * Only the rendered version survives serialization.
  +   *
  +   */
  +  public String getRenderedMessage() {
  +    if ((renderedMessage == null) && (message != null)) {
  +      if (message instanceof String) {
           renderedMessage = (String)message;
         } else {
  -        LoggerRepository repository = logger.getLoggerRepository(  );
  +        // The logger has a back-reference to the repository containing it
  +        LoggerRepository repository = logger.getLoggerRepository();
   
  -        if ( repository instanceof RendererSupport ) {
  +        if (repository instanceof RendererSupport) {
             RendererSupport rs = (RendererSupport)repository;
  -          renderedMessage = rs.getRendererMap(  ).findAndRender( message );
  +          renderedMessage = rs.getRendererMap().findAndRender(message);
           } else {
  -          renderedMessage = message.toString(  );
  +          renderedMessage = message.toString();
           }
         }
       }
  @@ -571,41 +638,66 @@
       return renderedMessage;
     }
   
  +  /**
  +   * 
  +   * @param renderedMessage The renderedMessage to set.
  +   * @throws IllegalStateException if renderedMessage  has been already set.
  +   * @since 1.3
  +   */
  +  public void setRenderedMessage(String renderedMessage) throws IllegalStateException {
  +    if(this.renderedMessage != null) {
  +       throw new IllegalStateException("renderedMessage has been already set."); 
  +    }
  +    this.renderedMessage = renderedMessage;
  +  }
   
     /**
      * Returns the time when the application started, in milliseconds elapsed
      * since 01.01.1970.
      */
  -  public static long getStartTime(  ) {
  +  public static long getStartTime() {
       return startTime;
     }
   
   
     /**
  -   * 
  +   *
      * @since 1.3
      */
     public long getSequenceNumber() {
       return sequenceNumber;
     }
   
  +
     /**
  -   * 
  +   *
      * @since 1.3
      */
     public void setSequenceNumber(long sequenceNumber) {
       this.sequenceNumber = sequenceNumber;
     }
  -  
  -  public String getThreadName(  ) {
  -    if ( threadName == null ) {
  -      threadName = ( Thread.currentThread(  ) ).getName(  );
  +
  +
  +  public String getThreadName() {
  +    if (threadName == null) {
  +      threadName = (Thread.currentThread()).getName();
       }
   
       return threadName;
     }
   
  -
  +   /**
  +     * @param threadName The threadName to set.
  +     * @throws IllegalStateException If threadName has been already set.
  +   */
  +   public void setThreadName(String threadName) throws IllegalStateException {
  +    if(this.threadName != null) {
  +      throw new IllegalStateException("threadName has been already set");
  +    }
  +    this.threadName = threadName;
  +   }
  +  
  +  
     /**
      * Returns the throwable information contained within this event. May be
      * <code>null</code> if there is no such information.
  @@ -617,7 +709,7 @@
      *
      * @since 1.1
      */
  -  public ThrowableInformation getThrowableInformation(  ) {
  +  public ThrowableInformation getThrowableInformation() {
       return throwableInfo;
     }
   
  @@ -625,29 +717,29 @@
     /**
      * Return this event's throwable's string[] representaion.
      */
  -  public String[] getThrowableStrRep(  ) {
  -    if ( throwableInfo == null ) {
  +  public String[] getThrowableStrRep() {
  +    if (throwableInfo == null) {
         return null;
       } else {
  -      return throwableInfo.getThrowableStrRep(  );
  +      return throwableInfo.getThrowableStrRep();
       }
     }
   
   
  -  private void readLevel( ObjectInputStream ois )
  +  private void readLevel(ObjectInputStream ois)
            throws java.io.IOException, ClassNotFoundException {
  -    int p = ois.readInt(  );
  +    int p = ois.readInt();
   
       try {
  -      String className = (String)ois.readObject(  );
  +      String className = (String)ois.readObject();
   
  -      if ( className == null ) {
  -        level = Level.toLevel( p );
  +      if (className == null) {
  +        level = Level.toLevel(p);
         } else {
  -        Method m = (Method)methodCache.get( className );
  +        Method m = (Method)methodCache.get(className);
   
  -        if ( m == null ) {
  -          Class clazz = Loader.loadClass( className );
  +        if (m == null) {
  +          Class clazz = Loader.loadClass(className);
   
             // Note that we use Class.getDeclaredMethod instead of
             // Class.getMethod. This assumes that the Level subclass
  @@ -655,92 +747,108 @@
             // requirement. Actually, it does not make sense for Level
             // subclasses NOT to implement this method. Also note that
             // only Level can be subclassed and not Priority.
  -          m = clazz.getDeclaredMethod( TO_LEVEL, TO_LEVEL_PARAMS );
  -          methodCache.put( className, m );
  +          m = clazz.getDeclaredMethod(TO_LEVEL, TO_LEVEL_PARAMS);
  +          methodCache.put(className, m);
           }
   
  -        PARAM_ARRAY[ 0 ] = new Integer( p );
  -        level = (Level)m.invoke( null, PARAM_ARRAY );
  +        PARAM_ARRAY[0] = new Integer(p);
  +        level = (Level)m.invoke(null, PARAM_ARRAY);
         }
  -    } catch ( Exception e ) {
  -      LogLog.warn( "Level deserialization failed, reverting to default.", e );
  -      level = Level.toLevel( p );
  +    } catch (Exception e) {
  +      LogLog.warn("Level deserialization failed, reverting to default.", e);
  +      level = Level.toLevel(p);
       }
     }
   
   
  -  private void readObject( ObjectInputStream ois )
  +  private void readObject(ObjectInputStream ois)
            throws java.io.IOException, ClassNotFoundException {
  -    ois.defaultReadObject(  );
  -    readLevel( ois );
  +    ois.defaultReadObject();
  +    readLevel(ois);
   
       // Make sure that no location info is available to Layouts
  -    if ( locationInfo == null ) {
  -      locationInfo = new LocationInfo( null, null );
  +    if (locationInfo == null) {
  +      locationInfo = new LocationInfo(null, null);
       }
     }
   
  +  /**
  +   * @return Returns the properties specific for this event. The returned 
  +   * value can be null.
  +   * @since 1.3
  +   */
  +  public Map getProperties() {
  +    return properties;
  +  }
  +
  +
  +  /**
  +   * @param properties The properties to set.
  +   */
  +  public void setProperties(Hashtable properties) {
  +    this.properties = properties;
  +  }
   
     /**
      * Set a string property using a key and a string value.  since 1.3
      */
  -  public void setProperty( String key, String value ) {
  -    if ( properties == null ) {
  -      properties = new Hashtable( 5 );    // create a small hashtable
  +  public void setProperty(String key, String value) {
  +    if (properties == null) {
  +      properties = new Hashtable(5);    // create a small hashtable
       }
   
  -    if ( value != null ) {
  -      properties.put( key, value );
  +    if (value != null) {
  +      properties.put(key, value);
       } else {
  -      properties.remove( key );
  +      properties.remove(key);
       }
     }
   
   
  -  private void writeObject( ObjectOutputStream oos )
  +  private void writeObject(ObjectOutputStream oos)
            throws java.io.IOException {
       // Aside from returning the current thread name the wgetThreadName
       // method sets the threadName variable.
  -    this.getThreadName(  );
  +    this.getThreadName();
   
       // This sets the renders the message in case it wasn't up to now.
  -    this.getRenderedMessage(  );
  +    this.getRenderedMessage();
   
       // This call has a side effect of setting this.ndc and
       // setting ndcLookupRequired to false if not already false.
  -    this.getNDC(  );
  +    this.getNDC();
   
  -    // This call has a side effect of setting this.mdcCopy and
  -    // setting mdcLookupRequired to false if not already false.
  -    this.getMDCCopy(  );
  +    // This call has a side effect of creating a copy of MDC context information
  +    // as well as a copy the properties for the containing LoggerRepository.
  +    this.createProperties();
   
       // This sets the throwable sting representation of the event throwable.
  -    this.getThrowableStrRep(  );
  +    this.getThrowableStrRep();
   
  -    oos.defaultWriteObject(  );
  +    oos.defaultWriteObject();
   
       // serialize this event's level
  -    writeLevel( oos );
  +    writeLevel(oos);
     }
   
   
  -  private void writeLevel( ObjectOutputStream oos )
  +  private void writeLevel(ObjectOutputStream oos)
            throws java.io.IOException {
  -    oos.writeInt( level.toInt(  ) );
  +    oos.writeInt(level.toInt());
   
  -    Class clazz = level.getClass(  );
  +    Class clazz = level.getClass();
   
  -    if ( clazz == Level.class ) {
  -      oos.writeObject( null );
  +    if (clazz == Level.class) {
  +      oos.writeObject(null);
       } else {
         // writing directly the Class object would be nicer, except that
         // serialized a Class object can not be read back by JDK
         // 1.1.x. We have to resort to this hack instead.
  -      oos.writeObject( clazz.getName(  ) );
  +      oos.writeObject(clazz.getName());
       }
     }
  -  
  -  
  +
  +
     /**
      * Getter for the event's time stamp. The time stamp is calculated starting
      * from 1970-01-01 GMT.
  @@ -750,14 +858,34 @@
     public long getTimeStamp() {
       return timeStamp;
     }
  -  
  +
  +
     /**
      * Setter for the even'ts time stamp.
      * See also {@see #getTimeStamp}.
      * @since 1.3
      */
  - 
     public void setTimeStamp(long timeStamp) {
       this.timeStamp = timeStamp;
  +  }
  +
  +
  +  /**
  +   * Get the fully qualified name of the calling logger sub-class/wrapper.
  +   * @since 1.3
  +   */
  +  public String getFQNOfLoggerClass() {
  +    return fqnOfLoggerClass;
  +  }
  +
  +
  +  /**
  +   * Set the fully qualified name of the calling logger sub-class/wrapper.
  +   *
  +   * @since 1.3
  +   * @param fqnOfLoggerClass
  +   */
  +  public void setFQNOfLoggerClass(String fqnOfLoggerClass) {
  +    this.fqnOfLoggerClass = fqnOfLoggerClass;
     }
   }
  
  
  
  1.51      +28 -0     logging-log4j/src/java/org/apache/log4j/Hierarchy.java
  
  Index: Hierarchy.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Hierarchy.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- Hierarchy.java	4 May 2004 19:04:37 -0000	1.50
  +++ Hierarchy.java	9 May 2004 18:37:56 -0000	1.51
  @@ -35,6 +35,7 @@
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +import java.util.Map;
   import java.util.Vector;
   
   
  @@ -77,6 +78,7 @@
     int thresholdInt;
     Level threshold;
     PluginRegistry pluginRegistry;
  +  Map properties;
     
     boolean emittedNoAppenderWarning = false;
     boolean emittedNoResourceBundleWarning = false;
  @@ -98,6 +100,7 @@
       setThreshold(Level.ALL);
       this.root.setHierarchy(this);
       rendererMap = new RendererMap();
  +    properties = new Hashtable();
       defaultFactory = new DefaultCategoryFactory();
     }
   
  @@ -230,6 +233,31 @@
       }
     }
   
  +  /* 
  +   * Get the properties for this repository.
  +   * 
  +   * @see org.apache.log4j.spi.LoggerRepository#getProperties()
  +   *
  +   */
  +  public Map getProperties() {
  +    return properties;
  +  }
  +
  +  /* 
  +   * Get a property of this repository.
  +   * @see org.apache.log4j.spi.LoggerRepository#getProperty(java.lang.String)
  +   */
  +  public String getProperty(String key) {
  +     return (String) properties.get(key);
  +  }
  +
  +  /* 
  +   * Set a property by key and value. The property will be shared by all
  +   * events in this repository.
  +   */
  +  public void setProperty(String key, String value) {
  +   properties.put(key, value);
  +  }
   
     /**
        The string form of {@link #setThreshold(Level)}.
  
  
  
  1.17      +5 -5      logging-log4j/src/java/org/apache/log4j/MDC.java
  
  Index: MDC.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/MDC.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MDC.java	27 Feb 2004 16:47:28 -0000	1.16
  +++ MDC.java	9 May 2004 18:37:56 -0000	1.17
  @@ -49,14 +49,14 @@
     }
   
     /**
  -   * Put a context value (the <code>o</code> parameter) as identified
  +   * Put a context value (the <code>val</code> parameter) as identified
      * with the <code>key</code> parameter into the current thread's
      * context map.
      *
      * <p>If the current thread does not have a context map it is
      * created as a side effect.
      * */
  -  public static void put(String key, Object o) {
  +  public static void put(String key, String val) {
       Hashtable ht = (Hashtable) tlm.get();
   
       if (ht == null) {
  @@ -64,7 +64,7 @@
         tlm.set(ht);
       }
   
  -    ht.put(key, o);
  +    ht.put(key, val);
     }
   
     /**
  @@ -72,11 +72,11 @@
      *
      *  <p>This method has no side effects.
      * */
  -  public static Object get(String key) {
  +  public static String get(String key) {
       Hashtable ht = (Hashtable) tlm.get();
   
       if ((ht != null) && (key != null)) {
  -      return ht.get(key);
  +      return (String) ht.get(key);
       } else {
         return null;
       }
  
  
  
  1.35      +1 -1      logging-log4j/src/java/org/apache/log4j/AsyncAppender.java
  
  Index: AsyncAppender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/AsyncAppender.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- AsyncAppender.java	27 Feb 2004 16:47:28 -0000	1.34
  +++ AsyncAppender.java	9 May 2004 18:37:56 -0000	1.35
  @@ -92,7 +92,7 @@
       event.getThreadName();
   
       // Get a copy of this thread's MDC.
  -    event.getMDCCopy();
  +    event.createProperties();
   
       if (locationInfo) {
         event.getLocationInformation();
  
  
  
  1.79      +19 -19    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.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- Category.java	27 Feb 2004 16:47:28 -0000	1.78
  +++ Category.java	9 May 2004 18:37:56 -0000	1.79
  @@ -427,8 +427,8 @@
      * further checks.
      */
     protected void forcedLog(
  -    String fqcn, Priority level, Object message, Throwable t) {
  -    callAppenders(new LoggingEvent(fqcn, this, level, message, t));
  +    String fqcn, Level level, Object message, Throwable t) {
  +    callAppenders(new LoggingEvent(fqcn, (Logger) this, level, message, t));
     }
   
     /**
  @@ -851,12 +851,12 @@
      * @see #setResourceBundle
      * @since 0.8.4
      */
  -  public void l7dlog(Priority priority, String key, Throwable t) {
  -    if (repository.isDisabled(priority.level)) {
  +  public void l7dlog(Level level, String key, Throwable t) {
  +    if (repository.isDisabled(level.level)) {
         return;
       }
   
  -    if (priority.isGreaterOrEqual(this.getEffectiveLevel())) {
  +    if (level.isGreaterOrEqual(this.getEffectiveLevel())) {
         String msg = getResourceBundleString(key);
   
         // if message corresponding to 'key' could not be found in the
  @@ -865,7 +865,7 @@
           msg = key;
         }
   
  -      forcedLog(FQCN, priority, msg, t);
  +      forcedLog(FQCN, level, msg, t);
       }
     }
   
  @@ -879,12 +879,12 @@
      * @since 0.8.4
      */
     public void l7dlog(
  -    Priority priority, String key, Object[] params, Throwable t) {
  -    if (repository.isDisabled(priority.level)) {
  +    Level level, String key, Object[] params, Throwable t) {
  +    if (repository.isDisabled(level.level)) {
         return;
       }
   
  -    if (priority.isGreaterOrEqual(this.getEffectiveLevel())) {
  +    if (level.isGreaterOrEqual(this.getEffectiveLevel())) {
         String pattern = getResourceBundleString(key);
         String msg;
   
  @@ -894,33 +894,33 @@
           msg = java.text.MessageFormat.format(pattern, params);
         }
   
  -      forcedLog(FQCN, priority, msg, t);
  +      forcedLog(FQCN, level, msg, t);
       }
     }
   
     /**
      * This generic form is intended to be used by wrappers.
      */
  -  public void log(Priority priority, Object message, Throwable t) {
  -    if (repository.isDisabled(priority.level)) {
  +  public void log(Level level, Object message, Throwable t) {
  +    if (repository.isDisabled(level.level)) {
         return;
       }
   
  -    if (priority.isGreaterOrEqual(this.getEffectiveLevel())) {
  -      forcedLog(FQCN, priority, message, t);
  +    if (level.isGreaterOrEqual(this.getEffectiveLevel())) {
  +      forcedLog(FQCN, level, message, t);
       }
     }
   
     /**
      * This generic form is intended to be used by wrappers.
      */
  -  public void log(Priority priority, Object message) {
  -    if (repository.isDisabled(priority.level)) {
  +  public void log(Level level, Object message) {
  +    if (repository.isDisabled(level.level)) {
         return;
       }
   
  -    if (priority.isGreaterOrEqual(this.getEffectiveLevel())) {
  -      forcedLog(FQCN, priority, message, null);
  +    if (level.isGreaterOrEqual(this.getEffectiveLevel())) {
  +      forcedLog(FQCN, level, message, null);
       }
     }
   
  @@ -934,7 +934,7 @@
      * @param t The throwable of the logging request, may be null.
      */
     public void log(
  -    String callerFQCN, Priority level, Object message, Throwable t) {
  +    String callerFQCN, Level level, Object message, Throwable t) {
       if (repository.isDisabled(level.level)) {
         return;
       }
  
  
  
  1.4       +1 -1      logging-log4j/src/java/org/apache/log4j/pattern/RelativeTimePatternConverter.java
  
  Index: RelativeTimePatternConverter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/RelativeTimePatternConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RelativeTimePatternConverter.java	27 Feb 2004 16:47:32 -0000	1.3
  +++ RelativeTimePatternConverter.java	9 May 2004 18:37:56 -0000	1.4
  @@ -37,7 +37,7 @@
   
     public StringBuffer convert(LoggingEvent event) {
       buf.setLength(0);
  -    buf.append(Long.toString(event.timeStamp - LoggingEvent.getStartTime()));
  +    buf.append(Long.toString(event.getTimeStamp() - LoggingEvent.getStartTime()));
       return buf;
     }
   }
  
  
  
  1.4       +1 -1      logging-log4j/src/java/org/apache/log4j/pattern/DatePatternConverter.java
  
  Index: DatePatternConverter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/DatePatternConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DatePatternConverter.java	27 Feb 2004 16:47:32 -0000	1.3
  +++ DatePatternConverter.java	9 May 2004 18:37:56 -0000	1.4
  @@ -64,7 +64,7 @@
     public StringBuffer convert(LoggingEvent event) {
       buf.setLength(0);
   
  -    date.setTime(event.timeStamp);
  +    date.setTime(event.getTimeStamp());
   
       String converted = null;
   
  
  
  
  1.5       +5 -5      logging-log4j/src/java/org/apache/log4j/pattern/PropertiesPatternConverter.java
  
  Index: PropertiesPatternConverter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/PropertiesPatternConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PropertiesPatternConverter.java	27 Feb 2004 16:47:32 -0000	1.4
  +++ PropertiesPatternConverter.java	9 May 2004 18:37:56 -0000	1.5
  @@ -23,13 +23,13 @@
   
   /**
    * Able to handle the contents of the LoggingEvent's Property bundle and either
  - * output the entire contents of the properties in a similar format to the java.util.Hashtable.toString()
  - * , or to output the value of a specific key within the property bundle
  + * output the entire contents of the properties in a similar format to the
  + * java.util.Hashtable.toString(), or to output the value of a specific key 
  + * within the property bundle
    * when this pattern converter has the option set.
    *
  - * @author Paul Smith (but totally based (i.e 'copied') on the MDCPatternConverter by Ceki G&uuml;lc&uuml;)
  - * with only minor alterations
  - *
  + * @author Paul Smith
  + * @author Ceki G&uuml;lc&uuml;
    *@since 1.3
    */
   public class PropertiesPatternConverter extends PatternConverter {
  
  
  
  1.12      +1 -2      logging-log4j/src/java/org/apache/log4j/pattern/PatternParser.java
  
  Index: PatternParser.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/PatternParser.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PatternParser.java	27 Feb 2004 16:47:32 -0000	1.11
  +++ PatternParser.java	9 May 2004 18:37:56 -0000	1.12
  @@ -92,8 +92,7 @@
       globalRulesRegistry.put("x", NDCPatternConverter.class.getName());
       globalRulesRegistry.put("ndc", NDCPatternConverter.class.getName());
       
  -    globalRulesRegistry.put("X", MDCPatternConverter.class.getName());
  -    globalRulesRegistry.put("mdc", MDCPatternConverter.class.getName());
  +    globalRulesRegistry.put("X", PropertiesPatternConverter.class.getName());
       
       globalRulesRegistry.put("properties", PropertiesPatternConverter.class.getName());
       globalRulesRegistry.put("throwable", ThrowableInformationPatternConverter.class.getName());
  
  
  
  1.27      +1 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ChainsawCyclicBufferTableModel.java	5 Apr 2004 07:22:11 -0000	1.26
  +++ ChainsawCyclicBufferTableModel.java	9 May 2004 18:37:56 -0000	1.27
  @@ -359,7 +359,7 @@
         return event.getLoggerName();
   
       case ChainsawColumns.INDEX_TIMESTAMP_COL_NAME:
  -      return new Date(event.timeStamp);
  +      return new Date(event.getTimeStamp());
   
       case ChainsawColumns.INDEX_MESSAGE_COL_NAME:
         return event.getRenderedMessage();
  
  
  
  1.19      +0 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
  
  Index: ChainsawAppenderHandler.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ChainsawAppenderHandler.java	4 May 2004 22:45:04 -0000	1.18
  +++ ChainsawAppenderHandler.java	9 May 2004 18:37:56 -0000	1.19
  @@ -20,7 +20,6 @@
   import org.apache.log4j.LogManager;
   import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.net.SocketReceiver;
  -import org.apache.log4j.plugins.PluginRegistry;
   import org.apache.log4j.rule.ExpressionRule;
   import org.apache.log4j.rule.Rule;
   import org.apache.log4j.spi.LoggingEvent;
  
  
  
  1.6       +1 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/ColumnComparator.java
  
  Index: ColumnComparator.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ColumnComparator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ColumnComparator.java	27 Feb 2004 16:47:29 -0000	1.5
  +++ ColumnComparator.java	9 May 2004 18:37:56 -0000	1.6
  @@ -112,7 +112,7 @@
           break;
           
          case ChainsawColumns.INDEX_TIMESTAMP_COL_NAME:
  -       		sort = (e1.timeStamp<e2.timeStamp ? -1 : (e1.timeStamp==e2.timeStamp ? 0 : 1));
  +       		sort = (e1.getTimeStamp()<e2.getTimeStamp() ? -1 : (e1.getTimeStamp()==e2.getTimeStamp() ? 0 : 1));
          		break;
          		
          case ChainsawColumns.INDEX_THREAD_COL_NAME:
  
  
  
  1.96      +5 -4      logging-log4j/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/build.xml,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- build.xml	5 Apr 2004 17:06:02 -0000	1.95
  +++ build.xml	9 May 2004 18:37:56 -0000	1.96
  @@ -13,7 +13,7 @@
     <!-- The build.properties file defines the parth to local jar files -->
     <property file="build.properties"/>
   
  -  <property name="version" value="1.3alpha"/>
  +  <property name="version" value="1.3alpha0"/>
   
     <!-- The base directory relative to which most targets are built -->
     <property name="base" value="."/>
  @@ -402,7 +402,7 @@
       <fail unless="chainsaw-libraries-present" message="Chainsaw v2 needs Jakarta ORO, and it appears your are missing the Jakarta ORO package.  Please check the build.properties file."/>
     </target>
     
  -  <target name="chainsaw" depends="chainsawRunCheck, build.chainsaw, log4j.jar, log4j-chainsaw.jar" description="Builds and runs Chainsaw v2" >
  +  <target name="chainsaw" depends="chainsawRunCheck, build.chainsaw, log4j.jar, chainsaw.jar" description="Builds and runs Chainsaw v2" >
   
       <!-- Need to fork to avoid problems -->
       <java classname="org.apache.log4j.chainsaw.LogUI" fork="yes"
  @@ -414,7 +414,7 @@
     <!-- ================================================================= -->
     <!-- Aactual work is done in the dependencies.                         -->
     <!-- ================================================================= -->
  -  <target name="jar" depends="log4j.jar, log4j-chainsaw.jar, log4j-lf5.jar">
  +  <target name="jar" depends="log4j.jar, chainsaw.jar, log4j-lf5.jar">
     </target>
   
    <!-- ================================================================= -->
  @@ -436,6 +436,7 @@
                   ${stem}/spi/*.class,
                   ${stem}/net/*.class,
                   ${stem}/jdbc/*.class,
  +                ${stem}/db/*.class,
                   ${stem}/varia/*.class,
                   ${stem}/nt/*.class,
                   ${stem}/rolling/**/*.class,
  @@ -466,7 +467,7 @@
     <!-- ================================================================= -->
     <!-- Create log4j-chainsaw.jar, excluding everything else              -->
     <!-- ================================================================= -->
  -  <target name="log4j-chainsaw.jar" depends="build">
  +  <target name="chainsaw.jar" depends="build">
       <delete>
         <fileset dir="${jar.dest}">
           <include name="${log4j-chainsaw.jar}"/>
  
  
  
  1.5       +2 -2      logging-log4j/src/java/org/apache/log4j/test/MDCStress.java
  
  Index: MDCStress.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/test/MDCStress.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MDCStress.java	6 Aug 2001 21:16:22 -0000	1.4
  +++ MDCStress.java	9 May 2004 18:37:56 -0000	1.5
  @@ -98,8 +98,8 @@
   
       createChildren(randomInt(BRANCHING_FACTOR), depth);
   
  -    MDC.put("depth", new Integer(depth));
  -    MDC.put("total", new Integer(this.total));
  +    MDC.put("depth", new Integer(depth).toString());
  +    MDC.put("total", new Integer(this.total).toString());
   
       log.debug("Set MDC variables.");   
   
  
  
  
  1.6       +5 -5      logging-log4j/src/java/org/apache/log4j/test/PatternTest.java
  
  Index: PatternTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/test/PatternTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PatternTest.java	18 Mar 2003 13:33:30 -0000	1.5
  +++ PatternTest.java	9 May 2004 18:37:56 -0000	1.6
  @@ -4,7 +4,7 @@
   import org.apache.log4j.LogManager;
   import org.apache.log4j.PropertyConfigurator;
   import org.apache.log4j.Category;
  -import org.apache.log4j.Priority;
  +import org.apache.log4j.Level;
   /**
      This class is a test of the PatternLayout class.
   
  @@ -55,8 +55,8 @@
       CAT.error("Message " + ++i);
       root.error("Message " + i);
       
  -    CAT.log(Priority.FATAL, "Message " + ++i);
  -    root.log(Priority.FATAL, "Message " + i);    
  +    CAT.log(Level.FATAL, "Message " + ++i);
  +    root.log(Level.FATAL, "Message " + i);    
       
       Exception e = new Exception("Just testing");
       CAT.debug("Message " + ++i, e);
  @@ -71,8 +71,8 @@
       CAT.error("Message " + ++i, e);
       root.error("Message " + i, e);    
   
  -    CAT.log(Priority.FATAL, "Message " + ++i, e);
  -    root.log(Priority.FATAL, "Message " + i, e);    
  +    CAT.log(Level.FATAL, "Message " + ++i, e);
  +    root.log(Level.FATAL, "Message " + i, e);    
       
       LogManager.shutdown();
     }
  
  
  
  1.4       +1 -1      logging-log4j/src/java/org/apache/log4j/test/CategoryWrapper.java
  
  Index: CategoryWrapper.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/test/CategoryWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CategoryWrapper.java	13 Feb 2001 17:37:28 -0000	1.3
  +++ CategoryWrapper.java	9 May 2004 18:37:56 -0000	1.4
  @@ -47,7 +47,7 @@
       // method). This is highly unusual. The fqcn of the wrapper is
       // normally sufficient.
   
  -    c.log(FQCN+".print", Priority.DEBUG, msg, null);
  +    c.log(FQCN+".print", Level.DEBUG, msg, null);
     }
     
     
  
  
  
  1.7       +3 -3      logging-log4j/src/java/org/apache/log4j/test/FQCNTest.java
  
  Index: FQCNTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/test/FQCNTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FQCNTest.java	11 Feb 2002 12:22:53 -0000	1.6
  +++ FQCNTest.java	9 May 2004 18:37:56 -0000	1.7
  @@ -9,7 +9,7 @@
   
   import org.apache.log4j.*;
   import org.apache.log4j.spi.*;
  -//import org.apache.log4j.xml.examples.XPriority;
  +//import org.apache.log4j.xml.examples.XLevel;
   
   /** 
      This class is a shallow test of the various appenders and
  @@ -72,12 +72,12 @@
   
     public 
     void debug1(Object message) {    
  -    super.log(FQCN, Priority.DEBUG, message + " world.", null);    
  +    super.log(FQCN, Level.DEBUG, message + " world.", null);    
     }
   
     public
     void debug2(Object message) {
  -    super.log(FQCN, Priority.DEBUG, message, null); 
  +    super.log(FQCN, Level.DEBUG, message, null); 
     }
   
     protected
  
  
  
  1.10      +1 -1      logging-log4j/src/java/org/apache/log4j/helpers/DateLayout.java
  
  Index: DateLayout.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/helpers/DateLayout.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DateLayout.java	27 Feb 2004 16:47:31 -0000	1.9
  +++ DateLayout.java	9 May 2004 18:37:56 -0000	1.10
  @@ -115,7 +115,7 @@
   
     public void dateFormat(StringBuffer buf, LoggingEvent event) {
       if (dateFormat != null) {
  -      date.setTime(event.timeStamp);
  +      date.setTime(event.getTimeStamp());
         dateFormat.format(date, buf, this.pos);
         buf.append(' ');
       }
  
  
  
  1.10      +1 -1      logging-log4j/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java
  
  Index: SocketServerTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SocketServerTestCase.java	4 May 2004 14:37:53 -0000	1.9
  +++ SocketServerTestCase.java	9 May 2004 18:37:56 -0000	1.10
  @@ -325,7 +325,7 @@
       assertTrue(Compare.compare(FILTERED, "witness/socketServer.8"));
     }
   
  -  static void common(String dc, String key, Object o) {
  +  static void common(String dc, String key, String o) {
       int i = -1;
       NDC.push(dc);
       MDC.put(key, o);
  
  
  
  1.2       +5 -1      logging-log4j/src/java/org/apache/log4j/db/dialect/mysql.sql
  
  Index: mysql.sql
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/dialect/mysql.sql,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mysql.sql	4 May 2004 09:36:03 -0000	1.1
  +++ mysql.sql	9 May 2004 18:37:56 -0000	1.2
  @@ -1,8 +1,12 @@
  +# This SQL script creates the required tables by org.apache.log4j.db.DBAppender and 
  +# org.apache.log4j.db.DBReceiver.
  +#
  +# It is intended for MySQL databases.
  +
   
   BEGIN;
   DROP TABLE IF EXISTS loggging_event;
   DROP TABLE IF EXISTS mdc;
  -
   COMMIT;
   
   
  
  
  
  1.3       +7 -2      logging-log4j/src/java/org/apache/log4j/db/dialect/oracle.sql
  
  Index: oracle.sql
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/dialect/oracle.sql,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- oracle.sql	4 May 2004 10:04:42 -0000	1.2
  +++ oracle.sql	9 May 2004 18:37:56 -0000	1.3
  @@ -1,7 +1,12 @@
  +# This SQL script creates the required tables by org.apache.log4j.db.DBAppender and 
  +# org.apache.log4j.db.DBReceiver.
  +#
  +# It is intended for Oracle databases.
  +
  +# WARNING WARNING WARNING 
   # The following SQL script is untested in the sense that it has not
   # been executed against an Oracle database. Thus, it can contain typos
  -# or can contain incorrect SQL statements.
  -
  +# or may even contain incorrect SQL statements.
   
   
   CREATE SEQUENCE logging_event_id_seq MINVALUE 1 START WITH 1;
  
  
  
  1.2       +4 -0      logging-log4j/src/java/org/apache/log4j/db/dialect/postgresql.sql
  
  Index: postgresql.sql
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/dialect/postgresql.sql,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- postgresql.sql	4 May 2004 09:36:03 -0000	1.1
  +++ postgresql.sql	9 May 2004 18:37:56 -0000	1.2
  @@ -1,3 +1,7 @@
  +# This SQL script creates the required tables by org.apache.log4j.db.DBAppender and 
  +# org.apache.log4j.db.DBReceiver.
  +#
  +# It is intended for PostgreSQL databases.
   
   DROP TABLE    mdc;
   DROP TABLE    logging_event;
  
  
  
  1.5       +2 -2      logging-log4j/src/java/org/apache/log4j/nt/test/NTMin.java
  
  Index: NTMin.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/nt/test/NTMin.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NTMin.java	20 May 2002 09:52:57 -0000	1.4
  +++ NTMin.java	9 May 2004 18:37:56 -0000	1.5
  @@ -11,7 +11,7 @@
   import org.apache.log4j.Category;
   import org.apache.log4j.BasicConfigurator;
   import org.apache.log4j.nt.NTEventLogAppender;
  -import org.apache.log4j.Priority;
  +import org.apache.log4j.Level;
   import org.apache.log4j.NDC;
   
   
  @@ -55,7 +55,7 @@
       cat.info( "Message " + i++);
       cat.warn( "Message " + i++);
       cat.error( "Message " + i++);
  -    cat.log(Priority.FATAL, "Message " + i++);
  +    cat.log(Level.FATAL, "Message " + i++);
       cat.debug("Message " + i++,  new Exception("Just testing."));
     }
   }
  
  
  
  1.4       +1 -1      logging-log4j/src/java/org/apache/log4j/lf5/LF5Appender.java
  
  Index: LF5Appender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/lf5/LF5Appender.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LF5Appender.java	5 May 2003 21:14:38 -0000	1.3
  +++ LF5Appender.java	9 May 2004 18:37:56 -0000	1.4
  @@ -92,7 +92,7 @@
       String nestedDiagnosticContext = event.getNDC();
       String threadDescription = event.getThreadName();
       String level = event.getLevel().toString();
  -    long time = event.timeStamp;
  +    long time = event.getTimeStamp();
       LocationInfo locationInfo = event.getLocationInformation();
   
       // Add the logging event information to a LogRecord
  
  
  
  1.6       +4 -4      logging-log4j/tests/src/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java
  
  Index: BoundedFIFOTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BoundedFIFOTestCase.java	27 Feb 2004 16:47:36 -0000	1.5
  +++ BoundedFIFOTestCase.java	9 May 2004 18:37:56 -0000	1.6
  @@ -23,8 +23,8 @@
   package org.apache.log4j.helpers;
   
   import junit.framework.TestCase;
  -import org.apache.log4j.Category;
  -import org.apache.log4j.Priority;
  +import org.apache.log4j.Level;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.helpers.BoundedFIFO;
   import org.apache.log4j.spi.LoggingEvent;
   
  @@ -34,13 +34,13 @@
      @author Ceki G&uuml;lc&uuml;
      @since 0.9.1 */
   public class BoundedFIFOTestCase extends TestCase {
  -  static Category cat = Category.getInstance("x");
  +  static Logger cat = Logger.getLogger("x");
     static int MAX = 1000;
     static LoggingEvent[] e = new LoggingEvent[MAX];
   
     {
       for (int i = 0; i < MAX; i++) {
  -      e[i] = new LoggingEvent("", cat, Priority.DEBUG, "e" + i, null);
  +      e[i] = new LoggingEvent("", cat, Level.DEBUG, "e" + i, null);
       }
     }
   
  
  
  
  1.4       +4 -4      logging-log4j/tests/src/java/org/apache/log4j/helpers/CyclicBufferTestCase.java
  
  Index: CyclicBufferTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/helpers/CyclicBufferTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CyclicBufferTestCase.java	27 Feb 2004 16:47:36 -0000	1.3
  +++ CyclicBufferTestCase.java	9 May 2004 18:37:56 -0000	1.4
  @@ -26,8 +26,8 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  -import org.apache.log4j.Category;
  -import org.apache.log4j.Priority;
  +import org.apache.log4j.Level;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.helpers.CyclicBuffer;
   import org.apache.log4j.spi.LoggingEvent;
   
  @@ -39,13 +39,13 @@
   
   */
   public class CyclicBufferTestCase extends TestCase {
  -  static Category cat = Category.getInstance("x");
  +  static Logger logger = Logger.getLogger("x");
     static int MAX = 1000;
     static LoggingEvent[] e = new LoggingEvent[MAX];
   
     {
       for (int i = 0; i < MAX; i++) {
  -      e[i] = new LoggingEvent("", cat, Priority.DEBUG, "e" + i, null);
  +      e[i] = new LoggingEvent("", logger, Level.DEBUG, "e" + i, null);
       }
     }
   
  
  
  
  1.7       +1 -1      logging-log4j/src/java/org/apache/log4j/net/test/SMTPMin.java
  
  Index: SMTPMin.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/test/SMTPMin.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SMTPMin.java	18 Mar 2003 13:33:33 -0000	1.6
  +++ SMTPMin.java	9 May 2004 18:37:57 -0000	1.7
  @@ -47,7 +47,7 @@
       cat.info( "Message " + i++);
       cat.warn( "Message " + i++);
       cat.error( "Message " + i++);
  -    cat.log(Priority.FATAL, "Message " + i++);
  +    cat.log(Level.FATAL, "Message " + i++);
       LogManager.shutdown();
       Thread.currentThread().getThreadGroup().list();
     }
  
  
  
  1.5       +2 -2      logging-log4j/src/java/org/apache/log4j/net/test/SocketMin.java
  
  Index: SocketMin.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/test/SocketMin.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SocketMin.java	20 May 2002 09:52:57 -0000	1.4
  +++ SocketMin.java	9 May 2004 18:37:57 -0000	1.5
  @@ -9,8 +9,8 @@
   
   import org.apache.log4j.Category;
   import org.apache.log4j.BasicConfigurator;
  +import org.apache.log4j.Level;
   import org.apache.log4j.net.SocketAppender;
  -import org.apache.log4j.Priority;
   import org.apache.log4j.NDC;
   import java.io.InputStreamReader;
   
  @@ -96,7 +96,7 @@
       cat.info( "Message " + i++);
       cat.warn( "Message " + i++);
       cat.error( "Message " + i++);
  -    cat.log(Priority.FATAL, "Message " + i++);
  +    cat.log(Level.FATAL, "Message " + i++);
       cat.debug("Message " + i++,  new Exception("Just testing."));
     }
   }
  
  
  
  1.5       +2 -2      logging-log4j/src/java/org/apache/log4j/net/test/SyslogMin.java
  
  Index: SyslogMin.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/test/SyslogMin.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SyslogMin.java	20 May 2002 09:52:57 -0000	1.4
  +++ SyslogMin.java	9 May 2004 18:37:57 -0000	1.5
  @@ -9,8 +9,8 @@
   package org.apache.log4j.net.test;
   
   import org.apache.log4j.Category;
  +import org.apache.log4j.Level;
   import org.apache.log4j.PropertyConfigurator;
  -import org.apache.log4j.Priority;
   import org.apache.log4j.NDC;
   
   
  @@ -54,7 +54,7 @@
       CAT.info( "Message " + i++);
       CAT.warn( "Message " + i++);
       CAT.error( "Message " + i++);
  -    CAT.log(Priority.FATAL, "Message " + i++);
  +    CAT.log(Level.FATAL, "Message " + i++);
       CAT.debug("Message " + i++,  new Exception("Just testing."));
     }
   }
  
  
  
  1.27      +29 -33    logging-log4j/src/java/org/apache/log4j/xml/XMLLayout.java
  
  Index: XMLLayout.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/XMLLayout.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- XMLLayout.java	28 Apr 2004 17:54:03 -0000	1.26
  +++ XMLLayout.java	9 May 2004 18:37:57 -0000	1.27
  @@ -25,11 +25,7 @@
   
   import java.io.IOException;
   import java.io.Writer;
  -
  -import java.util.ArrayList;
  -import java.util.Collections;
   import java.util.Iterator;
  -import java.util.List;
   import java.util.Set;
   
   
  @@ -105,7 +101,7 @@
       output.write("<log4j:event logger=\"");
       output.write(event.getLoggerName());
       output.write("\" timestamp=\"");
  -    output.write(Long.toString(event.timeStamp));
  +    output.write(Long.toString(event.getTimeStamp()));
       output.write("\" sequenceNumber=\"");
       output.write(Long.toString(event.getSequenceNumber()));
       output.write("\" level=\"");
  @@ -129,34 +125,34 @@
         output.write("]]></log4j:NDC>\r\n");
       }
   
  -    Set mdcKeySet = event.getMDCKeySet();
  -
  -    if ((mdcKeySet != null) && (mdcKeySet.size() > 0)) {
  -      /**
  -      * Normally a sort isn't required, but for Test Case purposes
  -      * we need to guarantee a particular order.
  -      *
  -      * Besides which, from a human readable point of view, the sorting
  -      * of the keys is kinda nice..
  -      */
  -      List sortedList = new ArrayList(mdcKeySet);
  -      Collections.sort(sortedList);
  -
  -      output.write("<log4j:MDC>\r\n");
  -
  -      Iterator iter = sortedList.iterator();
  -
  -      while (iter.hasNext()) {
  -        String propName = iter.next().toString();
  -	output.write("    <log4j:data name=\"" + propName);
  -
  -        String propValue = event.getMDC(propName).toString();
  -        output.write("\" value=\"" + propValue);
  -        output.write("\"/>\r\n");
  -      }
  -
  -      output.write("</log4j:MDC>\r\n");
  -    }
  +//    Set mdcKeySet = event.getMDCKeySet();
  +//
  +//    if ((mdcKeySet != null) && (mdcKeySet.size() > 0)) {
  +//      /**
  +//      * Normally a sort isn't required, but for Test Case purposes
  +//      * we need to guarantee a particular order.
  +//      *
  +//      * Besides which, from a human readable point of view, the sorting
  +//      * of the keys is kinda nice..
  +//      */
  +//      List sortedList = new ArrayList(mdcKeySet);
  +//      Collections.sort(sortedList);
  +//
  +//      output.write("<log4j:MDC>\r\n");
  +//
  +//      Iterator iter = sortedList.iterator();
  +//
  +//      while (iter.hasNext()) {
  +//        String propName = iter.next().toString();
  +//       	output.write("    <log4j:data name=\"" + propName);
  +//
  +//        String propValue = event.getMDC(propName).toString();
  +//        output.write("\" value=\"" + propValue);
  +//        output.write("\"/>\r\n");
  +//      }
  +//
  +//      output.write("</log4j:MDC>\r\n");
  +//    }
   
       String[] s = event.getThrowableStrRep();
   
  
  
  
  1.5       +0 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/receivers/ReceiversTreeModel.java
  
  Index: ReceiversTreeModel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/receivers/ReceiversTreeModel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ReceiversTreeModel.java	4 May 2004 19:04:38 -0000	1.4
  +++ ReceiversTreeModel.java	9 May 2004 18:37:57 -0000	1.5
  @@ -33,7 +33,6 @@
   import org.apache.log4j.plugins.Plugin;
   import org.apache.log4j.plugins.PluginEvent;
   import org.apache.log4j.plugins.PluginListener;
  -import org.apache.log4j.plugins.PluginRegistry;
   import org.apache.log4j.plugins.Receiver;
   
   
  
  
  
  1.7       +2 -2      logging-log4j/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
  
  Index: EventDetailLayout.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EventDetailLayout.java	27 Feb 2004 16:47:31 -0000	1.6
  +++ EventDetailLayout.java	9 May 2004 18:37:57 -0000	1.7
  @@ -179,7 +179,7 @@
      * @return new LoggingEvent
      */
     private static LoggingEvent copyForHTML(LoggingEvent event) {
  -    String fqnCategory = escape(event.fqnOfCategoryClass);
  +    String fqnCategory = escape(event.getFQNOfLoggerClass());
       Logger logger = Logger.getLogger(event.getLoggerName());
       String threadName = event.getThreadName();
       Object msg = event.getMessage();
  @@ -193,7 +193,7 @@
       Hashtable properties = formatProperties(event);
       LoggingEvent copy =
         new LoggingEvent(
  -        fqnCategory, logger, event.timeStamp, event.getLevel(), threadName, msg,
  +        fqnCategory, logger, event.getTimeStamp(), event.getLevel(), threadName, msg,
           ndc, mdc, throwableStringRep, li, properties);
   
       return copy;
  
  
  
  1.8       +3 -3      logging-log4j/src/java/org/apache/log4j/xml/test/DOMTest.java
  
  Index: DOMTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/test/DOMTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMTest.java	27 Feb 2004 16:47:35 -0000	1.7
  +++ DOMTest.java	9 May 2004 18:37:57 -0000	1.8
  @@ -17,8 +17,8 @@
   package org.apache.log4j.xml.test;
   
   import org.apache.log4j.Category;
  +import org.apache.log4j.Level;
   import org.apache.log4j.LogManager;
  -import org.apache.log4j.Priority;
   import org.apache.log4j.xml.DOMConfigurator;
   
   
  @@ -70,8 +70,8 @@
       cat.error("Message " + ++i);
       root.error("Message " + i);
   
  -    cat.log(Priority.FATAL, "Message " + ++i);
  -    root.log(Priority.FATAL, "Message " + i);
  +    cat.log(Level.FATAL, "Message " + ++i);
  +    root.log(Level.FATAL, "Message " + i);
   
       Exception e = new Exception("Just testing");
       cat.debug("Message " + ++i, e);
  
  
  

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


Re: cvs commit: logging-log4j/src/java/org/apache/log4j/xml/test DOMTest.java

Posted by Ceki Gülcü <ce...@qos.ch>.
Hello all,

With this commit, I added a properties support in LoggerRepository. It
is not possible to set a property at the repository level such that it
is shared by all events generated by that repository.

I also merged MDC properties and LoggerRepository properties into one
at the LoggerEvent level. The LoggingEvent.getMDCKeySet and
LoggingEvent.getMDC(String) methods have been replaced by the more
general LoggingEvent.getPropertyKeySet and
LoggingEvent.getProperty(String) methods.

XMLLayout no longer outputs a <log4j:MDC> element. Its contents have
been merged with <log4j:properties> element.

Thus, your code no longer needs to worry about whether a property is
set in the MDC or elsewhere.

As a result of these changes, chainsaw code no longer compiles. I did
not want to mess with chainsaw code.



At 08:37 PM 5/9/2004, ceki@apache.org wrote:
>ceki        2004/05/09 11:37:57
>
>   Modified:    src/java/org/apache/log4j/spi LoggingEventFieldResolver.java
>                         LoggerRepository.java LoggingEvent.java
>                src/java/org/apache/log4j Hierarchy.java MDC.java
>                         AsyncAppender.java Category.java
>                src/java/org/apache/log4j/pattern
>                         RelativeTimePatternConverter.java
>                         DatePatternConverter.java
>                         PropertiesPatternConverter.java PatternParser.java
>                src/java/org/apache/log4j/chainsaw
>                         ChainsawCyclicBufferTableModel.java
>                         ChainsawAppenderHandler.java ColumnComparator.java
>                .        build.xml
>                src/java/org/apache/log4j/test MDCStress.java
>                         PatternTest.java CategoryWrapper.java FQCNTest.java
>                src/java/org/apache/log4j/helpers DateLayout.java
>                tests/src/java/org/apache/log4j/net
>                         SocketServerTestCase.java
>                src/java/org/apache/log4j/db/dialect mysql.sql oracle.sql
>                         postgresql.sql
>                src/java/org/apache/log4j/nt/test NTMin.java
>                src/java/org/apache/log4j/lf5 LF5Appender.java
>                tests/src/java/org/apache/log4j/helpers
>                         BoundedFIFOTestCase.java CyclicBufferTestCase.java
>                src/java/org/apache/log4j/net/test SMTPMin.java
>                         SocketMin.java SyslogMin.java
>                src/java/org/apache/log4j/xml XMLLayout.java
>                src/java/org/apache/log4j/chainsaw/receivers
>                         ReceiversTreeModel.java
>                src/java/org/apache/log4j/chainsaw/layout
>                         EventDetailLayout.java
>                src/java/org/apache/log4j/xml/test DOMTest.java
>   Removed:     src/java/org/apache/log4j/pattern MDCPatternConverter.java
>   Log:
>   - Added a properties map to LoggerRepository
>   - Merged MDC properties and LoggerRepository properties into a single
>   property map in LoggingEvent. As such, the MDC related get/set
>    properties methods have been removed.
>   - All fields of LoggingEvent now have setters. The complicated
>   constructors required to create a LoggingEvent in one shot are now 
> deprecated.

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



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