logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r821258 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ChainsawCyclicBufferTableModel.java LogPanel.java vfs/VFSLogFilePatternReceiver.java
Date Sat, 03 Oct 2009 06:33:30 GMT
Author: sdeboy
Date: Sat Oct  3 06:33:30 2009
New Revision: 821258

URL: http://svn.apache.org/viewvc?rev=821258&view=rev
Log:
Chainsaw UI updates 
 - improve event load performance by holding off on tablemodel update notification until the
entire batch is processed (50K+ events loaded in just a few seconds on a fast machine)
VFS/LogFilePatternReceiver changes
 - improve event parsing by assuming logger and level must not contain spaces
 - rework logFormat parsing to beter support properties (when the property name contains part
of a keyword name, or vice versa: PROP(TIME), PROP(LOGGER1), etc)

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java

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=821258&r1=821257&r2=821258&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
Sat Oct  3 06:33:30 2009
@@ -511,11 +511,6 @@
       }
     }
 
-    if (rowAdded) {
-      int lastAdded = getLastAdded();
-      fireTableEvent(lastAdded, lastAdded, 1);
-    }
-
     return rowAdded;
   }
 
@@ -555,7 +550,7 @@
   }
 
   /**
-  * @param key
+  * @param e
   */
   private void fireNewKeyColumnAdded(NewKeyEvent e) {
     NewKeyListener[] listeners =

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=821258&r1=821257&r2=821258&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 Sat Oct 
3 06:33:30 2009
@@ -711,7 +711,7 @@
     table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent evt) {
             if (((evt.getFirstIndex() == evt.getLastIndex())
-                && (evt.getFirstIndex() > 0)) || (evt.getValueIsAdjusting()))
{
+                && (evt.getFirstIndex() > 0) && previousLastIndex != -1)
|| (evt.getValueIsAdjusting())) {
               return;
             }
             boolean lastIndexOnLastRow = (evt.getLastIndex() == (table.getRowCount() - 1));
@@ -741,7 +741,7 @@
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent evt) {
           if (((evt.getFirstIndex() == evt.getLastIndex())
-              && (evt.getFirstIndex() > 0)) || (evt.getValueIsAdjusting())) {
+              && (evt.getFirstIndex() > 0) && previousLastIndex != -1)
|| (evt.getValueIsAdjusting())) {
             return;
           }
 
@@ -1475,8 +1475,8 @@
         if (isPaused()) {
           return;
         }
-
         final int selectedRow = table.getSelectedRow();
+        final int startingRow = table.getRowCount();
         final LoggingEvent selectedEvent;
         if (selectedRow >= 0) {
           selectedEvent = tableModel.getRow(selectedRow);
@@ -1486,14 +1486,22 @@
 
         boolean rowAdded = false;
 
+        int addedRowCount = 0;
         for (Iterator iter = events.iterator(); iter.hasNext();) {
           LoggingEvent event = (LoggingEvent) iter.next();
 
           updateOtherModels(event);
 
           boolean isCurrentRowAdded = tableModel.isAddRow(event);
+          if (isCurrentRowAdded) {
+              addedRowCount++;
+          }
           rowAdded = rowAdded || isCurrentRowAdded;
         }
+        //fire after adding all events
+        if (rowAdded) {
+          tableModel.fireTableEvent(startingRow, startingRow + addedRowCount, addedRowCount);
+        }
 
         //tell the model to notify the count listeners
         tableModel.notifyCountListeners();
@@ -2195,6 +2203,7 @@
    * Reset the LoggingEvent container, detail panel and status bar
    */
   private void clearModel() {
+    previousLastIndex = -1;
     tableModel.clearModel();
 
     synchronized (detail) {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java?rev=821258&r1=821257&r2=821258&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
Sat Oct  3 06:33:30 2009
@@ -417,6 +417,9 @@
                             } catch (Error err) {
                                 getLogger().info(getPath() + " - unable to refresh fileobject",
err);
                             }
+                            if (lastFileSize == 0) {
+                                getLogger().info(getPath() + " - loading file");
+                            }
                             //could have been truncated or appended to (don't do anything
if same size)
                             if (fileObject.getContent().getSize() < lastFileSize) {
                                 reader = new InputStreamReader(fileObject.getContent().getInputStream());



Mime
View raw message