logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Pain" <stephen.p...@db.com>
Subject RE: save filtered events from chainsaw (thread moved from log4j-user)
Date Tue, 20 Jul 2004 21:23:16 GMT

Hi Scott -

Made the change, works nicely - patch below :) (four files are changed)

A note in the release notes is probably a good idea, since the behaviour has changed &
people could lose events if they're relying on the previous behaviour.

Cheers,
Stephen

Index: ChainsawCyclicBufferTableModel.java
===================================================================
RCS file: /home/cvspublic/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
retrieving revision 1.31
diff -u -r1.31 ChainsawCyclicBufferTableModel.java
--- ChainsawCyclicBufferTableModel.java   21 May 2004 18:45:07 -0000    1.31
+++ ChainsawCyclicBufferTableModel.java   20 Jul 2004 21:12:02 -0000
@@ -281,6 +281,16 @@
     return list;
   }

+  public List getFilteredEvents() {
+     List list = new ArrayList(filteredList.size());
+
+     synchronized (filteredList) {
+       list.addAll(filteredList);
+     }
+
+     return list;
+  }
+
   public int getRowIndex(LoggingEvent e) {
     synchronized (filteredList) {
       return filteredList.indexOf(e);
Index: EventContainer.java
===================================================================
RCS file: /home/cvspublic/logging-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java,v
retrieving revision 1.15
diff -u -r1.15 EventContainer.java
--- EventContainer.java 12 May 2004 06:37:30 -0000    1.15
+++ EventContainer.java 20 Jul 2004 21:12:02 -0000
@@ -107,6 +107,11 @@
   List getAllEvents();

   /**
+   * Returns a copied list containing the events in the model with filter applied
+   */
+  List getFilteredEvents();
+
+  /**
    * Returns the total number of events currently in the model (all, not just filtered)
    * @return
    */
Index: FileSaveAction.java
===================================================================
RCS file: /home/cvspublic/logging-log4j/src/java/org/apache/log4j/chainsaw/FileSaveAction.java,v
retrieving revision 1.5
diff -u -r1.5 FileSaveAction.java
--- FileSaveAction.java 27 Feb 2004 16:47:29 -0000    1.5
+++ FileSaveAction.java 20 Jul 2004 21:12:03 -0000
@@ -91,7 +91,7 @@

     if (selectedFile != null) {
       try {
-        List v = parent.getCurrentLogPanel().getEvents();
+        List v = parent.getCurrentLogPanel().getFilteredEvents();

         if (((v != null) && (v.size() == 0)) || (v == null)) {
           //no events to save
Index: LogPanel.java
===================================================================
RCS file: /home/cvspublic/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
retrieving revision 1.80
diff -u -r1.80 LogPanel.java
--- LogPanel.java 2 Jul 2004 05:49:27 -0000     1.80
+++ LogPanel.java 20 Jul 2004 21:12:08 -0000
@@ -1492,6 +1492,15 @@
     return tableModel.getAllEvents();
   }

+  /**
+   * Return the events that are visible with the current filter applied
+   *
+   * @return list of LoggingEvents
+   */
+  List getFilteredEvents() {
+     return tableModel.getFilteredEvents();
+  }
+
   List getMatchingEvents(Rule rule) {
     return tableModel.getMatchingEvents(rule);
   }




                                                                                         
                                             
                      "Scott Deboy"                                                      
                                             
                      <sdeboy@comotivsy        To:       "Log4J Users List" <log4j-user@logging.apache.org>
                           
                      stems.com>               cc:                                    
                                                
                                               Subject:  RE: save filtered events from chainsaw
                                       
                      20/07/2004 17:04                                                   
                                             
                      Please respond to                                                  
                                             
                      "Log4J Users                                                       
                                             
                      List"                                                              
                                             
                                                                                         
                                             
                                                                                         
                                             




If you have the time, that'd be great -

Submit the patches and any dev-related questions to the log4j-dev
mailing list

Scott

-----Original Message-----
From: Stephen Pain [mailto:stephen.pain@db.com]
Sent: Tuesday, July 20, 2004 8:50 AM
To: Log4J Users List
Subject: RE: save filtered events from chainsaw



Good point, it's easy to remove the filter if you decided to save all
the results.

Want me to look at implementing it, or shall I leave it to the experts?

Cheers,
Stephen





                      "Scott Deboy"

                      <sdeboy@comotivsy        To:       "Log4J Users
List" <log4j-user@logging.apache.org>

                      stems.com>               cc:

                                               Subject:  RE: save
filtered events from chainsaw

                      20/07/2004 16:16

                      Please respond to

                      "Log4J Users

                      List"









Good idea, Stephen

It may be worth having the save always based on the filtered (currently
displayed) events.

Scott

-----Original Message-----
From: Stephen Pain [mailto:stephen.pain@db.com]
Sent: Tuesday, July 20, 2004 7:51 AM
To: log4j-user@logging.apache.org
Subject: save filtered events from chainsaw


Hi all,

I don't think it's currently possible to do this in chainsaw - please
correct me if I'm wrong... I'd like to be able to use chainsaw to filter
events, and then save those events to a file, but ONLY those events that
were still visible after the filter was applied.

The reason is that I'm regularly loading 50000+ events into chainsaw,
filtering them down to 100-200 events that encapsulate a particular
exception/scenario for further investigation, and then need to send the
relevant info off to someone else so that they can look into it further.
Sending 50MB files around and asking people to search for the bit
they're interested in is a waste of time when I've already done some
preliminary investigation - it would be much better if I could just send
a small, 100% relevant file.

Looking at the code, a change to ChainsawCyclicBufferTableModel +
LogPanel to expose the filteredList directly and then an additional
option in FileSaveAction to switch between getEvents and
getFilteredEvents should be sufficient.

Any thoughts?

Cheers,
Stephen



--

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.



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


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






--

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.



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


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






--

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.



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