logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw/filter FilterModel.java EventTypeEntryContainer.java
Date Mon, 10 May 2004 22:26:44 GMT
psmith      2004/05/10 15:26:44

  Modified:    src/java/org/apache/log4j/chainsaw
                        ChainsawCyclicBufferTableModel.java
                        ColumnComparator.java
               src/java/org/apache/log4j/chainsaw/filter FilterModel.java
                        EventTypeEntryContainer.java
  Log:
  getMDC* methods are gone.... All hail getProperty* methods.
  
  There's still some artifacts within Chainsaw that will 'display' the MDC stuff, 
  but in reality it's just forwarding on to the properties area.  So
  some duplicate information may be displayed within Chainsaw at the moment,
  such as a MDC & Property column showing the same data.
  
  Revision  Changes    Path
  1.28      +30 -29    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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ChainsawCyclicBufferTableModel.java	9 May 2004 18:37:56 -0000	1.27
  +++ ChainsawCyclicBufferTableModel.java	10 May 2004 22:26:44 -0000	1.28
  @@ -364,8 +364,8 @@
       case ChainsawColumns.INDEX_MESSAGE_COL_NAME:
         return event.getRenderedMessage();
   
  -    case ChainsawColumns.INDEX_MDC_COL_NAME:
  -      return getMDC(event);
  +//    case ChainsawColumns.INDEX_MDC_COL_NAME:
  +//      return getMDC(event);
   
       case ChainsawColumns.INDEX_NDC_COL_NAME:
         return event.getNDC();
  @@ -406,35 +406,35 @@
       default:
   
         if (columnIndex <= columnNames.size()) {
  -        return event.getMDC(columnNames.get(columnIndex).toString());
  +        return event.getProperty(columnNames.get(columnIndex).toString());
         }
       }
   
       return "";
     }
   
  -  private String getMDC(LoggingEvent event) {
  -    if (event.getMDCKeySet().size() == 0) {
  -      return "";
  -    }
  -
  -    Iterator iter = event.getMDCKeySet().iterator();
  -    StringBuffer mdc = new StringBuffer("{");
  -
  -    while (iter.hasNext()) {
  -      mdc.append("{");
  -
  -      Object key = iter.next();
  -      mdc.append(key);
  -      mdc.append(",");
  -      mdc.append(event.getMDC(key.toString()));
  -      mdc.append("}");
  -    }
  -
  -    mdc.append("}");
  -
  -    return mdc.toString();
  -  }
  +//  private String getMDC(LoggingEvent event) {
  +//    if (event.getMDCKeySet().size() == 0) {
  +//      return "";
  +//    }
  +//
  +//    Iterator iter = event.getMDCKeySet().iterator();
  +//    StringBuffer mdc = new StringBuffer("{");
  +//
  +//    while (iter.hasNext()) {
  +//      mdc.append("{");
  +//
  +//      Object key = iter.next();
  +//      mdc.append(key);
  +//      mdc.append(",");
  +//      mdc.append(event.getMDC(key.toString()));
  +//      mdc.append("}");
  +//    }
  +//
  +//    mdc.append("}");
  +//
  +//    return mdc.toString();
  +//  }
   
     private String getProperties(LoggingEvent event) {
       Iterator iter = event.getPropertyKeySet().iterator();
  @@ -481,15 +481,16 @@
       }
   
       /**
  -     * Is this a new MDC key we haven't seen before?
  +     * Is this a new Propert key we haven't seen before?  Remeber that now MDC has been
merged
  +     * into the Properties collection.s
        */
  -    boolean newColumn = uniqueMDCKeys.addAll(e.getMDCKeySet());
  +    boolean newColumn = uniqueMDCKeys.addAll(e.getPropertyKeySet());
   
       if (newColumn) {
         /**
          * If so, we should add them as columns and notify listeners.
          */
  -      for (Iterator iter = e.getMDCKeySet().iterator(); iter.hasNext();) {
  +      for (Iterator iter = e.getPropertyKeySet().iterator(); iter.hasNext();) {
           Object key = iter.next();
   
           if (!columnNames.contains(key)) {
  @@ -497,7 +498,7 @@
             LogLog.debug("Adding col '" + key + "', columNames=" + columnNames);
             fireNewKeyColumnAdded(
               new NewKeyEvent(
  -              this, columnNames.indexOf(key), key, e.getMDC(key.toString())));
  +              this, columnNames.indexOf(key), key, e.getProperty(key.toString())));
           }
         }
       }
  
  
  
  1.7       +3 -3      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ColumnComparator.java	9 May 2004 18:37:56 -0000	1.6
  +++ ColumnComparator.java	10 May 2004 22:26:44 -0000	1.7
  @@ -156,10 +156,10 @@
               }
               break;
               
  -      //other columns may be MDC values - see if there is an MDC value matching column
name 
  +      //other columns may be Property values - see if there is an Property value matching
column name 
         default:
  -          if (e1.getMDC(columnName) != null && e2.getMDC(columnName) != null) {
  -              sort = e1.getMDC(columnName).toString().compareToIgnoreCase(e2.getMDC(columnName).toString());
  +          if (e1.getProperty(columnName) != null && e2.getProperty(columnName)
!= null) {
  +              sort = e1.getProperty(columnName).toString().compareToIgnoreCase(e2.getProperty(columnName).toString());
             }
         }
       }
  
  
  
  1.8       +1 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/filter/FilterModel.java
  
  Index: FilterModel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/filter/FilterModel.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FilterModel.java	28 Mar 2004 10:04:31 -0000	1.7
  +++ FilterModel.java	10 May 2004 22:26:44 -0000	1.8
  @@ -36,7 +36,7 @@
       eventContainer.addLogger(event.getLoggerName());
       eventContainer.addThread(event.getThreadName());
       eventContainer.addNDC(event.getNDC());
  -    eventContainer.addMDCKeys(event.getMDCKeySet());
  +    eventContainer.addPropertyKeys(event.getPropertyKeySet());
   
       if (event.locationInformationExists()) {
         LocationInfo info = event.getLocationInformation();
  
  
  
  1.6       +4 -4      logging-log4j/src/java/org/apache/log4j/chainsaw/filter/EventTypeEntryContainer.java
  
  Index: EventTypeEntryContainer.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/filter/EventTypeEntryContainer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EventTypeEntryContainer.java	27 Feb 2004 16:47:31 -0000	1.5
  +++ EventTypeEntryContainer.java	10 May 2004 22:26:44 -0000	1.6
  @@ -38,7 +38,7 @@
     private Set ColumnNames = new HashSet();
     private Set Methods = new HashSet();
     private Set Classes = new HashSet();
  -  private Set MDCKeys = new HashSet();
  +  private Set propertyKeys = new HashSet();
     private Set NDCs = new HashSet();
     private Set Levels = new HashSet();
     private Set Loggers = new HashSet();
  @@ -136,8 +136,8 @@
       }
     }
   
  -  void addMDCKeys(Set keySet) {
  -    if (MDCKeys.addAll(keySet)) {
  +  void addPropertyKeys(Set keySet) {
  +    if (propertyKeys.addAll(keySet)) {
         for (Iterator iter = keySet.iterator(); iter.hasNext();) {
           Object element = iter.next();
           mdcListModel.addElement(element);
  @@ -187,7 +187,7 @@
     /**
      * @return
      */
  -  DefaultListModel getMdcListModel() {
  +  DefaultListModel getPropertiesListModel() {
       return mdcListModel;
     }
   
  
  
  

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


Mime
View raw message