logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r824265 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ChainsawConstants.java ChainsawCyclicBufferTableModel.java ChainsawTabbedPane.java LogPanel.java LogPanelPreferenceModel.java
Date Mon, 12 Oct 2009 08:52:26 GMT
Author: sdeboy
Date: Mon Oct 12 08:52:26 2009
New Revision: 824265

URL: http://svn.apache.org/viewvc?rev=824265&view=rev
Log:
Minor Chainsaw tweaks:
- Avoid case-sensitive column entry mismatch issues by making all columns stored in uppercase
- When a new tab is addd (which isn't the chainsaw-log tab), select the tab
- Add a serialversionuid member to logpanelpreferencemodel, preventing serialization issues

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawConstants.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawConstants.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawConstants.java?rev=824265&r1=824264&r2=824265&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawConstants.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawConstants.java
Mon Oct 12 08:52:26 2009
@@ -56,18 +56,18 @@
   static final String SETTINGS_EXTENSION = ".settings";
 
   //COLUMN NAMES
-  static final String LOGGER_COL_NAME = "Logger";
-  static final String TIMESTAMP_COL_NAME = "Timestamp";
-  static final String LEVEL_COL_NAME = "Level";
-  static final String THREAD_COL_NAME = "Thread";
-  static final String MESSAGE_COL_NAME = "Message";
+  static final String LOGGER_COL_NAME = "LOGGER";
+  static final String TIMESTAMP_COL_NAME = "TIMESTAMP";
+  static final String LEVEL_COL_NAME = "LEVEL";
+  static final String THREAD_COL_NAME = "THREAD";
+  static final String MESSAGE_COL_NAME = "MESSAGE";
   static final String NDC_COL_NAME = "NDC";
-  static final String THROWABLE_COL_NAME = "Throwable";
-  static final String CLASS_COL_NAME = "Class";
-  static final String METHOD_COL_NAME = "Method";
-  static final String FILE_COL_NAME = "File";
-  static final String LINE_COL_NAME = "Line";
-  static final String PROPERTIES_COL_NAME = "Properties";
+  static final String THROWABLE_COL_NAME = "THROWABLE";
+  static final String CLASS_COL_NAME = "CLASS";
+  static final String METHOD_COL_NAME = "METHOD";
+  static final String FILE_COL_NAME = "FILE";
+  static final String LINE_COL_NAME = "LINE";
+  static final String PROPERTIES_COL_NAME = "PROPERTIES";
   static final String ID_COL_NAME = "ID";
 
   //none is not a real column name, but is used by filters as a way to apply no filter for
colors or display

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java?rev=824265&r1=824264&r2=824265&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
Mon Oct 12 08:52:26 2009
@@ -338,7 +338,9 @@
   }
 
   public String getColumnName(int column) {
-    return columnNames.get(column).toString();
+      //columnNames all upper, make 1st char upper & rest lower
+      String col = (String) columnNames.get(column);
+      return col.substring(0, 1).toUpperCase() + col.substring(1).toLowerCase();
   }
 
   public LoggingEvent getRow(int row) {
@@ -498,15 +500,16 @@
        * If so, we should add them as columns and notify listeners.
        */
       for (Iterator iter = e.getPropertyKeySet().iterator(); iter.hasNext();) {
-        Object key = iter.next();
+        String key = iter.next().toString().toUpperCase();
 
-        //add all keys except the 'log4jid' key
-        if (!columnNames.contains(key) && !(Constants.LOG4J_ID_KEY.equalsIgnoreCase(key.toString())))
{
+        //add all keys except the 'log4jid' key (columnNames is all-caps)
+        if (!columnNames.contains(key) && !(Constants.LOG4J_ID_KEY.equalsIgnoreCase(key)))
{
           columnNames.add(key);
-          logger.debug("Adding col '" + key + "', columNames=" + columnNames);
+          logger.debug("Adding col '" + key + "', columnNames=" + columnNames);
+          String mixedCaseKey = key.substring(0, 1).toUpperCase() + key.substring(1).toLowerCase();
           fireNewKeyColumnAdded(
             new NewKeyEvent(
-              this, columnNames.indexOf(key), key, e.getProperty(key.toString())));
+              this, columnNames.indexOf(key), mixedCaseKey, e.getProperty(key)));
         }
       }
     }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java?rev=824265&r1=824264&r2=824265&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java
Mon Oct 12 08:52:26 2009
@@ -21,15 +21,11 @@
 */
 package org.apache.log4j.chainsaw;
 
-import org.apache.log4j.chainsaw.prefs.SettingsManager;
-import org.apache.log4j.chainsaw.prefs.SettingsListener;
-import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
-import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
-
 import java.awt.Component;
+import java.awt.EventQueue;
 import java.io.File;
-import java.io.FileWriter;
 import java.io.FileReader;
+import java.io.FileWriter;
 
 import javax.swing.Icon;
 import javax.swing.JComponent;
@@ -38,6 +34,11 @@
 import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.io.xml.DomDriver;
 
+import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
+import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
+import org.apache.log4j.chainsaw.prefs.SettingsListener;
+import org.apache.log4j.chainsaw.prefs.SettingsManager;
+
 
 /**
  * The only reason this class is needed is because
@@ -97,6 +98,13 @@
     super.insertTab(name, icon, component, null, getTabCount());
 
     super.fireStateChanged();
+    if (!"chainsaw-log".equals(name)) {
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                setSelectedTab(getTabCount() - 1);
+            }
+        });
+    }
   }
 
   public void setSelectedTab(int index) {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=824265&r1=824264&r2=824265&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Mon Oct 12
08:52:26 2009
@@ -235,7 +235,6 @@
   private final int dividerSize;
   static final String TABLE_COLUMN_ORDER = "table.columns.order";
   static final String TABLE_COLUMN_WIDTHS = "table.columns.widths";
-  static final String COLUMNS_EXTENSION = ".columns";
   static final String COLORS_EXTENSION = ".colors";
   private static final int LOG_PANEL_SERIALIZATION_VERSION_NUMBER = 1;
   private int previousLastIndex = -1;

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java?rev=824265&r1=824264&r2=824265&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
Mon Oct 12 08:52:26 2009
@@ -47,6 +47,7 @@
   public static final Collection DATE_FORMATS;
   private static final Logger logger = LogManager.getLogger(LogPanelPreferenceModel.class);
 
+ private static final long serialVersionUID = 7526472295622776147L;
   static {
     Collection list = new ArrayList();
 



Mime
View raw message