logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw/help tutorial.html
Date Wed, 12 May 2004 06:37:31 GMT
sdeboy      2004/05/11 23:37:31

  Modified:    src/java/org/apache/log4j/chainsaw
                        ChainsawCyclicBufferTableModel.java LogUI.java
                        ChainsawColumns.java LogPanel.java
                        EventContainer.java ChainsawConstants.java
               src/java/org/apache/log4j/chainsaw/filter
                        EventTypeEntryContainer.java FilterModel.java
               src/java/org/apache/log4j/rule ExpressionRuleContext.java
                        RuleTest.java
               src/java/org/apache/log4j/varia LogFilePatternReceiver.java
               src/java/org/apache/log4j/xml UtilLoggingXMLDecoder.java
                        XMLDecoder.java
               src/java/org/apache/log4j/chainsaw/layout
                        DefaultDetailLayout.html
               src/java/org/apache/log4j/chainsaw/prefs default.properties
               src/java/org/apache/log4j/chainsaw/help tutorial.html
  Log:
  - removed the 'MDC' column in Chainsaw
  - improved Chainsaw context menu support for properties, including property values
  - removed aggregated 'properties' column from Chainsaw - individual properties show up as
their own column (except log4jid property, which is displayed as the ID column)
  - modified XMLDecoder to accept MDC entries in the document but convert them to properties
  
  Revision  Changes    Path
  1.29      +6 -53     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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ChainsawCyclicBufferTableModel.java	10 May 2004 22:26:44 -0000	1.28
  +++ ChainsawCyclicBufferTableModel.java	12 May 2004 06:37:30 -0000	1.29
  @@ -75,7 +75,7 @@
     //because we may be using a cyclic buffer, if an ID is not provided in the property,

     //use and increment this row counter as the ID for each received row
     int uniqueRow;
  -  private Set uniqueMDCKeys = new HashSet();
  +  private Set uniquePropertyKeys = new HashSet();
     private Rule displayRule;
     private PropertyChangeSupport propertySupport =
       new PropertyChangeSupport(this);
  @@ -364,15 +364,9 @@
       case ChainsawColumns.INDEX_MESSAGE_COL_NAME:
         return event.getRenderedMessage();
   
  -//    case ChainsawColumns.INDEX_MDC_COL_NAME:
  -//      return getMDC(event);
  -
       case ChainsawColumns.INDEX_NDC_COL_NAME:
         return event.getNDC();
   
  -    case ChainsawColumns.INDEX_PROPERTIES_COL_NAME:
  -      return getProperties(event);
  -
       case ChainsawColumns.INDEX_THREAD_COL_NAME:
         return event.getThreadName();
   
  @@ -413,48 +407,6 @@
       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 getProperties(LoggingEvent event) {
  -    Iterator iter = event.getPropertyKeySet().iterator();
  -    StringBuffer prop = new StringBuffer("{");
  -
  -    while (iter.hasNext()) {
  -      prop.append("{");
  -
  -      Object key = iter.next();
  -      prop.append(key);
  -      prop.append(",");
  -      prop.append(event.getProperty(key.toString()));
  -      prop.append("}");
  -    }
  -
  -    prop.append("}");
  -
  -    return prop.toString();
  -  }
  -
     public boolean isAddRow(LoggingEvent e, boolean valueIsAdjusting) {
       boolean rowAdded = false;
   
  @@ -481,10 +433,10 @@
       }
   
       /**
  -     * Is this a new Propert key we haven't seen before?  Remeber that now MDC has been
merged
  -     * into the Properties collection.s
  +     * Is this a new Property key we haven't seen before?  Remember that now MDC has been
merged
  +     * into the Properties collection
        */
  -    boolean newColumn = uniqueMDCKeys.addAll(e.getPropertyKeySet());
  +    boolean newColumn = uniquePropertyKeys.addAll(e.getPropertyKeySet());
   
       if (newColumn) {
         /**
  @@ -493,7 +445,8 @@
         for (Iterator iter = e.getPropertyKeySet().iterator(); iter.hasNext();) {
           Object key = iter.next();
   
  -        if (!columnNames.contains(key)) {
  +        //add all keys except the 'log4jid' key
  +        if (!columnNames.contains(key) && !(ChainsawConstants.LOG4J_ID_KEY.equalsIgnoreCase(key.toString())))
{
             columnNames.add(key);
             LogLog.debug("Adding col '" + key + "', columNames=" + columnNames);
             fireNewKeyColumnAdded(
  
  
  
  1.89      +2 -2      logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- LogUI.java	4 May 2004 22:45:04 -0000	1.88
  +++ LogUI.java	12 May 2004 06:37:30 -0000	1.89
  @@ -267,7 +267,7 @@
       
       
       String config = model.getConfigurationURL();
  -    if(config!=null) {
  +    if(config!=null && (!(config.trim().equals("")))) {
           config = config.trim();
           LogLog.info("Using '" + config + "' for auto-configuration");
           try {
  @@ -559,7 +559,7 @@
       getFilterableColumns().add(ChainsawConstants.LOGGER_COL_NAME);
       getFilterableColumns().add(ChainsawConstants.THREAD_COL_NAME);
       getFilterableColumns().add(ChainsawConstants.NDC_COL_NAME);
  -    getFilterableColumns().add(ChainsawConstants.MDC_COL_NAME);
  +    getFilterableColumns().add(ChainsawConstants.PROPERTIES_COL_NAME);
       getFilterableColumns().add(ChainsawConstants.CLASS_COL_NAME);
       getFilterableColumns().add(ChainsawConstants.METHOD_COL_NAME);
       getFilterableColumns().add(ChainsawConstants.FILE_COL_NAME);
  
  
  
  1.6       +6 -11     logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawColumns.java
  
  Index: ChainsawColumns.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawColumns.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChainsawColumns.java	27 Feb 2004 16:47:29 -0000	1.5
  +++ ChainsawColumns.java	12 May 2004 06:37:30 -0000	1.6
  @@ -41,13 +41,11 @@
       columnNames.add(ChainsawConstants.THREAD_COL_NAME);
       columnNames.add(ChainsawConstants.MESSAGE_COL_NAME);
       columnNames.add(ChainsawConstants.NDC_COL_NAME);
  -    columnNames.add(ChainsawConstants.MDC_COL_NAME);
       columnNames.add(ChainsawConstants.THROWABLE_COL_NAME);
       columnNames.add(ChainsawConstants.CLASS_COL_NAME);
       columnNames.add(ChainsawConstants.METHOD_COL_NAME);
       columnNames.add(ChainsawConstants.FILE_COL_NAME);
       columnNames.add(ChainsawConstants.LINE_COL_NAME);
  -    columnNames.add(ChainsawConstants.PROPERTIES_COL_NAME);
   
       //NOTE:  ID must ALWAYS be last field because the model adds this value itself as an
identifier to the end of the consructed vector
       columnNames.add(ChainsawConstants.ID_COL_NAME);
  @@ -59,15 +57,12 @@
     public static final int INDEX_THREAD_COL_NAME = 4;
     public static final int INDEX_MESSAGE_COL_NAME = 5;
     public static final int INDEX_NDC_COL_NAME = 6;
  -  public static final int INDEX_MDC_COL_NAME = 7;
  -  public static final int INDEX_THROWABLE_COL_NAME = 8;
  -  public static final int INDEX_CLASS_COL_NAME = 9;
  -  public static final int INDEX_METHOD_COL_NAME = 10;
  -  public static final int INDEX_FILE_COL_NAME = 11;
  -  public static final int INDEX_LINE_COL_NAME = 12;
  -  public static final int INDEX_PROPERTIES_COL_NAME = 13;
  -  public static final int INDEX_ID_COL_NAME = 14;
  -
  +  public static final int INDEX_THROWABLE_COL_NAME = 7;
  +  public static final int INDEX_CLASS_COL_NAME = 8;
  +  public static final int INDEX_METHOD_COL_NAME = 9;
  +  public static final int INDEX_FILE_COL_NAME = 10;
  +  public static final int INDEX_LINE_COL_NAME = 11;
  +  public static final int INDEX_ID_COL_NAME = 12;
   
    public static final Cursor CURSOR_FOCUS_ON;
    static{
  
  
  
  1.70      +29 -30    logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
  
  Index: LogPanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- LogPanel.java	3 May 2004 08:00:48 -0000	1.69
  +++ LogPanel.java	12 May 2004 06:37:30 -0000	1.70
  @@ -16,29 +16,6 @@
   
   package org.apache.log4j.chainsaw;
   
  -import org.apache.log4j.Layout;
  -import org.apache.log4j.PatternLayout;
  -import org.apache.log4j.chainsaw.color.ColorPanel;
  -import org.apache.log4j.chainsaw.color.RuleColorizer;
  -import org.apache.log4j.chainsaw.filter.FilterModel;
  -import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  -import org.apache.log4j.chainsaw.icons.LineIconFactory;
  -import org.apache.log4j.chainsaw.layout.DefaultLayoutFactory;
  -import org.apache.log4j.chainsaw.layout.EventDetailLayout;
  -import org.apache.log4j.chainsaw.layout.LayoutEditorPane;
  -import org.apache.log4j.chainsaw.messages.MessageCenter;
  -import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.Profileable;
  -import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SettingsManager;
  -import org.apache.log4j.helpers.ISO8601DateFormat;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.rule.ExpressionRule;
  -import org.apache.log4j.rule.ExpressionRuleContext;
  -import org.apache.log4j.rule.Rule;
  -import org.apache.log4j.spi.LoggingEvent;
  -import org.apache.log4j.spi.LoggingEventFieldResolver;
  -
   import java.awt.BorderLayout;
   import java.awt.Component;
   import java.awt.Container;
  @@ -58,10 +35,8 @@
   import java.awt.event.MouseMotionAdapter;
   import java.awt.event.WindowAdapter;
   import java.awt.event.WindowEvent;
  -
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
  -
   import java.io.BufferedInputStream;
   import java.io.BufferedOutputStream;
   import java.io.EOFException;
  @@ -73,10 +48,8 @@
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
  -
   import java.text.NumberFormat;
   import java.text.SimpleDateFormat;
  -
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.HashMap;
  @@ -129,6 +102,29 @@
   import javax.swing.table.TableColumn;
   import javax.swing.table.TableColumnModel;
   
  +import org.apache.log4j.Layout;
  +import org.apache.log4j.PatternLayout;
  +import org.apache.log4j.chainsaw.color.ColorPanel;
  +import org.apache.log4j.chainsaw.color.RuleColorizer;
  +import org.apache.log4j.chainsaw.filter.FilterModel;
  +import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  +import org.apache.log4j.chainsaw.icons.LineIconFactory;
  +import org.apache.log4j.chainsaw.layout.DefaultLayoutFactory;
  +import org.apache.log4j.chainsaw.layout.EventDetailLayout;
  +import org.apache.log4j.chainsaw.layout.LayoutEditorPane;
  +import org.apache.log4j.chainsaw.messages.MessageCenter;
  +import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.Profileable;
  +import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SettingsManager;
  +import org.apache.log4j.helpers.ISO8601DateFormat;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.rule.ExpressionRule;
  +import org.apache.log4j.rule.ExpressionRuleContext;
  +import org.apache.log4j.rule.Rule;
  +import org.apache.log4j.spi.LoggingEvent;
  +import org.apache.log4j.spi.LoggingEventFieldResolver;
  +
   
   /**
    * A LogPanel provides a view to a collection of LoggingEvents.<br>
  @@ -252,9 +248,6 @@
       columnNameKeywordMap.put(
         ChainsawConstants.NDC_COL_NAME, LoggingEventFieldResolver.NDC_FIELD);
       columnNameKeywordMap.put(
  -      ChainsawConstants.PROPERTIES_COL_NAME,
  -      LoggingEventFieldResolver.PROP_FIELD);
  -    columnNameKeywordMap.put(
         ChainsawConstants.MESSAGE_COL_NAME, LoggingEventFieldResolver.MSG_FIELD);
       columnNameKeywordMap.put(
         ChainsawConstants.THREAD_COL_NAME, LoggingEventFieldResolver.THREAD_FIELD);
  @@ -557,6 +550,12 @@
        */
       tableModel = new ChainsawCyclicBufferTableModel();
       table = new JSortTable(tableModel);
  +    //add a listener to update the 'refine focus'
  +    tableModel.addNewKeyListener(new NewKeyListener() {
  +		public void newKeyAdded(NewKeyEvent e) {
  +            columnNameKeywordMap.put(e.getKey(), "PROP." + e.getKey());
  +		}
  +    });
   
       /*
        * Set the Display rule to use the mediator, the model will add itself as
  
  
  
  1.15      +1 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java
  
  Index: EventContainer.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- EventContainer.java	5 Apr 2004 07:22:12 -0000	1.14
  +++ EventContainer.java	12 May 2004 06:37:30 -0000	1.15
  @@ -46,7 +46,7 @@
       String propertyName, PropertyChangeListener l);
   
     /**
  -   * Adds a NewKeyListener to be notified when unique Key (MDC/Property keys)
  +   * Adds a NewKeyListener to be notified when unique Key (Property keys)
      * arrive into this EventContainer
      * @param l
      */
  
  
  
  1.10      +0 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawConstants.java
  
  Index: ChainsawConstants.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawConstants.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ChainsawConstants.java	27 Feb 2004 16:47:29 -0000	1.9
  +++ ChainsawConstants.java	12 May 2004 06:37:30 -0000	1.10
  @@ -58,7 +58,6 @@
     static final String THREAD_COL_NAME = "Thread";
     static final String MESSAGE_COL_NAME = "Message";
     static final String NDC_COL_NAME = "NDC";
  -  static final String MDC_COL_NAME = "MDC";
     static final String THROWABLE_COL_NAME = "Throwable";
     static final String CLASS_COL_NAME = "Class";
     static final String METHOD_COL_NAME = "Method";
  
  
  
  1.7       +32 -80    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EventTypeEntryContainer.java	10 May 2004 22:26:44 -0000	1.6
  +++ EventTypeEntryContainer.java	12 May 2004 06:37:30 -0000	1.7
  @@ -38,7 +38,6 @@
     private Set ColumnNames = new HashSet();
     private Set Methods = new HashSet();
     private Set Classes = new HashSet();
  -  private Set propertyKeys = new HashSet();
     private Set NDCs = new HashSet();
     private Set Levels = new HashSet();
     private Set Loggers = new HashSet();
  @@ -47,12 +46,13 @@
     private DefaultListModel columnNameListModel = new DefaultListModel();
     private DefaultListModel methodListModel = new DefaultListModel();
     private DefaultListModel classesListModel = new DefaultListModel();
  -  private DefaultListModel mdcListModel = new DefaultListModel();
  +  private DefaultListModel propListModel = new DefaultListModel();
     private DefaultListModel ndcListModel = new DefaultListModel();
     private DefaultListModel levelListModel = new DefaultListModel();
     private DefaultListModel loggerListModel = new DefaultListModel();
     private DefaultListModel threadListModel = new DefaultListModel();
     private DefaultListModel fileNameListModel = new DefaultListModel();
  +  private Map propertiesListModelMap = new HashMap();
     private Map modelMap = new HashMap();
     private static final String LOGGER_FIELD = "LOGGER";
     private static final String LEVEL_FIELD = "LEVEL";
  @@ -60,7 +60,7 @@
     private static final String FILE_FIELD = "FILE";
     private static final String THREAD_FIELD = "THREAD";
     private static final String METHOD_FIELD = "METHOD";
  -  private static final String MDC_FIELD = "MDC";
  +  private static final String PROP_FIELD = "PROP.";
     private static final String NDC_FIELD = "NDC";
   
     public EventTypeEntryContainer() {
  @@ -71,19 +71,30 @@
         modelMap.put(THREAD_FIELD, threadListModel);
         modelMap.put(METHOD_FIELD, methodListModel);
         modelMap.put(NDC_FIELD, ndcListModel);
  -      modelMap.put(MDC_FIELD, mdcListModel);
  +      modelMap.put(PROP_FIELD, propListModel);
     }
     
     public boolean modelExists(String fieldName) {
         if (fieldName != null) {
  -          return (modelMap.keySet().contains(fieldName.toUpperCase()));
  +        return (fieldName.toUpperCase().startsWith(PROP_FIELD) || modelMap.keySet().contains(fieldName.toUpperCase()));
         }
         return false;
     }
     
     public ListModel getModel(String fieldName) {
         if (fieldName != null) {
  -          return (ListModel)modelMap.get(fieldName.toUpperCase());
  +          ListModel model = (ListModel)modelMap.get(fieldName.toUpperCase());
  +          if (model != null) {
  +              return model;
  +          }
  +          //drop prop field and optional ticks around field name
  +          if (fieldName.startsWith(PROP_FIELD)) {
  +              fieldName = fieldName.substring(PROP_FIELD.length());
  +              if ((fieldName.startsWith("'")) && (fieldName.endsWith("'"))) {
  +                  fieldName = fieldName.substring(1, fieldName.length() - 1);
  +              }
  +          }
  +          return (ListModel)propertiesListModelMap.get(fieldName);
         }
         return null;
     } 
  @@ -136,79 +147,20 @@
       }
     }
   
  -  void addPropertyKeys(Set keySet) {
  -    if (propertyKeys.addAll(keySet)) {
  -      for (Iterator iter = keySet.iterator(); iter.hasNext();) {
  -        Object element = iter.next();
  -        mdcListModel.addElement(element);
  -      }
  +  void addProperties(Map properties) {
  +        for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
  +            Map.Entry entry = (Map.Entry)iter.next();
  +            if (!(propListModel.contains(entry.getKey()))) {
  +                propListModel.addElement(entry.getKey());
  +            }
  +            DefaultListModel model = (DefaultListModel)propertiesListModelMap.get(entry.getKey());
  +            if (model == null) {
  +                model = new DefaultListModel();
  +                propertiesListModelMap.put(entry.getKey(), model);
  +            }
  +            if (!(model.contains(entry.getValue()))) {
  +                model.addElement(entry.getValue());
  +            }
  +        }
       }
  -  }
  -
  -  ListModel getColumnListModel() {
  -    return columnNameListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getClassesListModel() {
  -    return classesListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getColumnNameListModel() {
  -    return columnNameListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getFileNameListModel() {
  -    return fileNameListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getLevelListModel() {
  -    return levelListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getLoggerListModel() {
  -    return loggerListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getPropertiesListModel() {
  -    return mdcListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getMethodListModel() {
  -    return methodListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getNdcListModel() {
  -    return ndcListModel;
  -  }
  -
  -  /**
  -   * @return
  -   */
  -  DefaultListModel getThreadListModel() {
  -    return threadListModel;
  -  }
   }
  
  
  
  1.9       +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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FilterModel.java	10 May 2004 22:26:44 -0000	1.8
  +++ FilterModel.java	12 May 2004 06:37:30 -0000	1.9
  @@ -36,7 +36,7 @@
       eventContainer.addLogger(event.getLoggerName());
       eventContainer.addThread(event.getThreadName());
       eventContainer.addNDC(event.getNDC());
  -    eventContainer.addPropertyKeys(event.getPropertyKeySet());
  +    eventContainer.addProperties(event.getProperties());
   
       if (event.locationInformationExists()) {
         LocationInfo info = event.getLocationInformation();
  
  
  
  1.6       +20 -16    logging-log4j/src/java/org/apache/log4j/rule/ExpressionRuleContext.java
  
  Index: ExpressionRuleContext.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rule/ExpressionRuleContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExpressionRuleContext.java	27 Feb 2004 16:47:33 -0000	1.5
  +++ ExpressionRuleContext.java	12 May 2004 06:37:30 -0000	1.6
  @@ -16,9 +16,6 @@
   
   package org.apache.log4j.rule;
   
  -import org.apache.log4j.chainsaw.filter.FilterModel;
  -import org.apache.log4j.spi.LoggingEventFieldResolver;
  -
   import java.awt.Point;
   import java.awt.event.InputEvent;
   import java.awt.event.KeyAdapter;
  @@ -31,6 +28,10 @@
   import javax.swing.JPopupMenu;
   import javax.swing.JScrollPane;
   import javax.swing.JTextField;
  +import javax.swing.ListModel;
  +
  +import org.apache.log4j.chainsaw.filter.FilterModel;
  +import org.apache.log4j.spi.LoggingEventFieldResolver;
   
   /**
    * A popup menu which assists in building expression rules.  Completes event keywords,
operators and 
  @@ -64,8 +65,7 @@
       fieldModel.addElement("EXCEPTION");
       fieldModel.addElement("TIMESTAMP");
       fieldModel.addElement("THREAD");
  -    fieldModel.addElement("MDC");
  -    fieldModel.addElement("PROP");
  +    fieldModel.addElement("PROP.");
   
       operatorModel.addElement("&&");
       operatorModel.addElement("||");
  @@ -91,7 +91,8 @@
           public void keyPressed(KeyEvent e) {
             if (e.getKeyCode() == KeyEvent.VK_ENTER) {
               String value = list.getSelectedValue().toString();
  -            if (getContextKey() != null) {
  +            String contextKey = getContextKey();
  +            if (contextKey != null && (!(contextKey.endsWith(".")))) {
                 value = "'"+value+"'";
               }
                   
  @@ -106,7 +107,8 @@
           public void mouseClicked(MouseEvent e) {
             if (e.getClickCount() == 2) {
               String value = list.getSelectedValue().toString();
  -            if (getContextKey() != null) {
  +            String contextKey = getContextKey();
  +            if (contextKey != null && (!(contextKey.endsWith(".")))) {
                 value = "'"+value+"'";
               }
               
  @@ -121,7 +123,9 @@
   
     private void updateField(String value) {
       if (textField.getSelectedText() == null) {
  -      value = value + " ";
  +        if (!(value.endsWith("."))) {
  +            value = value + " ";
  +        }
       }
   
       textField.replaceSelection(value);
  @@ -139,7 +143,11 @@
       String lastField = getContextKey();
   
       if (lastField != null) {
  -      list.setModel(filterModel.getContainer().getModel(lastField));
  +      ListModel model = filterModel.getContainer().getModel(lastField);
  +      if (model == null) {
  +        return;
  +      }
  +      list.setModel(model);
         list.setSelectedIndex(0);
   
         Point p = textField.getCaret().getMagicCaretPosition();
  @@ -212,10 +220,6 @@
         text.substring(lastFieldStartPosition, lastFieldPosition).toUpperCase()
             .trim();
   
  -    if (field.startsWith("MDC.")) {
  -      return true;
  -    }
  -
       if (resolver.isField(field)) {
         return true;
       }
  @@ -265,13 +269,13 @@
     }
   
     //subfields allow the key portion of a field to provide context menu support
  -  //and are available after the fieldname and a . (for example, MDC.)
  +  //and are available after the fieldname and a . (for example, PROP.)
     private String getSubField() {
       int currentPosition = textField.getSelectionStart();
       String text = textField.getText();
   
  -    if (text.substring(0, currentPosition).toUpperCase().endsWith("MDC.")) {
  -      return "MDC";
  +    if (text.substring(0, currentPosition).toUpperCase().endsWith("PROP.")) {
  +      return "PROP.";
       }
       return null;
     }
  
  
  
  1.5       +1 -1      logging-log4j/src/java/org/apache/log4j/rule/RuleTest.java
  
  Index: RuleTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rule/RuleTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RuleTest.java	10 May 2004 22:25:07 -0000	1.4
  +++ RuleTest.java	12 May 2004 06:37:30 -0000	1.5
  @@ -170,7 +170,7 @@
     public static void main(String[] args) {
       RuleTest test =
         new RuleTest(
  -        "( level ~= deb ) && ( logger like logger[1-2] || MDC.entry1 >= 234
)");
  +        "( level ~= deb ) && ( logger like logger[1-2] || PROP.entry1 >= 234
)");
       test.pack();
       test.setVisible(true);
     }
  
  
  
  1.9       +2 -2      logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
  
  Index: LogFilePatternReceiver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LogFilePatternReceiver.java	11 May 2004 13:31:07 -0000	1.8
  +++ LogFilePatternReceiver.java	12 May 2004 06:37:31 -0000	1.9
  @@ -88,7 +88,7 @@
    * is followed by a delimiter (-)
    *
    * LIMITATIONS:
  - * - no support for mdc, ndc, properties or the single-line version of throwable supported
by patternlayout
  + * - no support for ndc, properties or the single-line version of throwable supported by
patternlayout
    * - relativetime is set as a property
    * - loggers with spaces in their names are not supported (but may work if followed by
a delimiter,
    *   similar to wildcard example above)
  @@ -151,7 +151,7 @@
   
       //supported keyword replacements are expected to be single words, except for the MESSAGE
keyword,
       //which is expected to appear at the end of each entry in the log file
  -    //since throwable, mdc, ndc and properties can all have spaces, they're not yet supported
  +    //since throwable, ndc and properties can all have spaces, they're not yet supported
       //while loggers may containspaces, only loggers without spaces are currently supported
       //fullinfo pattern is not supported directly - build from individual keywords instead
       keywords.add(TIMESTAMP);
  
  
  
  1.11      +0 -2      logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
  
  Index: UtilLoggingXMLDecoder.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- UtilLoggingXMLDecoder.java	11 May 2004 13:31:07 -0000	1.10
  +++ UtilLoggingXMLDecoder.java	12 May 2004 06:37:31 -0000	1.11
  @@ -272,7 +272,6 @@
         String threadName = null;
         Object message = null;
         String ndc = null;
  -      Hashtable mdc = null;
         String[] exception = null;
         String className = null;
         String methodName = null;
  @@ -389,7 +388,6 @@
         threadName = null;
         message = null;
         ndc = null;
  -      mdc = null;
         exception = null;
         className = null;
         methodName = null;
  
  
  
  1.12      +7 -9      logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java
  
  Index: XMLDecoder.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLDecoder.java	11 May 2004 13:31:07 -0000	1.11
  +++ XMLDecoder.java	12 May 2004 06:37:31 -0000	1.12
  @@ -252,7 +252,6 @@
       String threadName = null;
       Object message = null;
       String ndc = null;
  -    Hashtable mdc = null;
       String[] exception = null;
       String className = null;
       String methodName = null;
  @@ -295,10 +294,9 @@
           if (tagName.equalsIgnoreCase("log4j:NDC")) {
             ndc = getCData(list.item(y));
           }
  -
  +        //still support receiving of MDC and convert to properties
           if (tagName.equalsIgnoreCase("log4j:MDC")) {
  -          mdc = new Hashtable();
  -
  +          properties = new Hashtable();
             NodeList propertyList = list.item(y).getChildNodes();
             int propertyLength = propertyList.getLength();
   
  @@ -311,7 +309,7 @@
                   property.getAttributes().getNamedItem("name").getNodeValue();
                 String value =
                   property.getAttributes().getNamedItem("value").getNodeValue();
  -              mdc.put(name, value);
  +              properties.put(name, value);
               }
             }
           }
  @@ -332,8 +330,9 @@
           }
   
           if (tagName.equalsIgnoreCase("log4j:properties")) {
  -          properties = new Hashtable();
  -
  +          if (properties == null) {
  +              properties = new Hashtable();
  +          }
             NodeList propertyList = list.item(y).getChildNodes();
             int propertyLength = propertyList.getLength();
   
  @@ -366,7 +365,7 @@
         Level levelImpl = null;
         if ((properties != null)  && (properties.get("log4j.eventtype") != null))
{
         	String s = (String)properties.get("log4j.eventtype");
  -		if (s.equalsIgnoreCase("util-logging")) {
  +		if ("util-logging".equalsIgnoreCase(s)) {
   			levelImpl=UtilLoggingLevel.toLevel(level);
   		}
         }
  @@ -400,7 +399,6 @@
         threadName = null;
         message = null;
         ndc = null;
  -      mdc = null;
         exception = null;
         className = null;
         methodName = null;
  
  
  
  1.6       +0 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/layout/DefaultDetailLayout.html
  
  Index: DefaultDetailLayout.html
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/layout/DefaultDetailLayout.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultDetailLayout.html	25 Jan 2004 11:06:59 -0000	1.5
  +++ DefaultDetailLayout.html	12 May 2004 06:37:31 -0000	1.6
  @@ -5,7 +5,6 @@
   <TR><TD><B>Thread</B><TD>%t</td></tr>
   <TR><TD><B>Message</B><TD>%m</td></tr>
   <TR><TD><B>NDC</B><TD>%x</td></tr>
  -<TR><TD><B>MDC</B><TD>%X</td></tr>
   <TR><TD><B>Class</B><TD>%C</td></tr>
   <TR><TD><B>Method</B><TD>%M</td></tr>
   <TR><TD><B>Line</B><TD>%L</td></tr>
  
  
  
  1.16      +2 -2      logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- default.properties	20 Apr 2004 00:39:40 -0000	1.15
  +++ default.properties	12 May 2004 06:37:31 -0000	1.16
  @@ -10,8 +10,8 @@
   main.window.height=480
   tabPlacement=3
   Responsiveness=3
  -table.columns.order=ID,Timestamp,Level,Logger,Thread,Message,NDC,MDC,Throwable,Class,Method,File,Line,Properties
  -table.columns.widths=50,150,50,100,150,300,150,100,300,150,100,100,100,100
  +table.columns.order=ID,Timestamp,Level,Logger,Thread,Message,NDC,Throwable,Class,Method,File,Line
  +table.columns.widths=50,150,50,100,150,300,150,100,300,150,100,100
   statusBar=true
   receivers=true
   toolbar=true
  
  
  
  1.11      +3 -4      logging-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html
  
  Index: tutorial.html
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- tutorial.html	3 May 2004 08:00:48 -0000	1.10
  +++ tutorial.html	12 May 2004 06:37:31 -0000	1.11
  @@ -148,14 +148,13 @@
   <li>EXCEPTION</li>
   <li>TIMESTAMP</li>
   <li>THREAD</li>
  -<li>MDC.[key name]</li>
   <li>PROP.[key name]</li>
   </ul>
   
   <ul>
  -<li><b>NOTE: </b>To build expressions using <b>MDC</b> or
<b>PROP (properties)</b> field identifiers, the key being evaluated must be added
after the field identifier and a period</li>
  +<li><b>NOTE: </b>To build expressions using <b>PROP (properties)</b>
field identifier, the key being evaluated must be added after the field identifier and a period</li>
    <li>Example: all events in the event table contain a '<b>log4jid</b>'
property (used during import/export of events).  To refine the display to display only rows
50 through 60, the expression <b>PROP.log4jid &gt= 50 && PROP.log4jid &lt=
60</b> can be used in the 'refine focus' field</li>
  -<b>NOTE:</b> MDC and PROP keys are case sensitive.  <b>PROP.log4jid</b>
is <b>not</b> equivalent to <b>PROP.LOG4JID</b>
  +<b>NOTE:</b> PROP keys are case sensitive.  <b>PROP.log4jid</b>
is <b>not</b> equivalent to <b>PROP.LOG4JID</b>
   </ul>
   <p>
   <b>Supported operators:</b></p>
  @@ -187,7 +186,7 @@
   <tr><td>To display all events with a level of info or greater</td><td><b>LEVEL
&gt= INFO</b></td></tr>
   <tr><td>To display all events which contain the words 'logged in' in the message</td><td>
<b>MSG ~= 'logged in'</b></td></tr>
   <tr><td>To display all events which contain an exception</td><td><b>EXCEPTION
EXISTS</b></td></tr>
  -<tr><td>To display all events associated with an MDC key of USERID with a value
of 'tester'</td><td><b>MDC.USERID == tester</b></td></tr>
  +<tr><td>To display all events associated with a PROP key of USERID with a value
of 'tester'</td><td><b>PROP.USERID == tester</b></td></tr>
   <tr><td>'and' the first and second examples together, 'or'd with the third</td><td><b>(
LEVEL &gt= INFO && MSG ~= 'logged in' ) || EXCEPTION EXISTS</b></td></tr>
   </table>
   
  
  
  

---------------------------------------------------------------------
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