logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r824604 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
Date Tue, 13 Oct 2009 06:23:59 GMT
Author: sdeboy
Date: Tue Oct 13 06:23:59 2009
New Revision: 824604

URL: http://svn.apache.org/viewvc?rev=824604&view=rev
Log:
Fix 47210 - -  ignore not ignoring, yet "focus on" works

'Ignore' was only working for specific packages, not subpackages, and only working if a logger
was selected in the list

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java?rev=824604&r1=824603&r2=824604&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
Tue Oct 13 06:23:59 2009
@@ -159,16 +159,16 @@
     	public boolean evaluate(LoggingEvent e)
         {
           String currentlySelectedLoggerName = getCurrentlySelectedLoggerName();
+          boolean hidden = e.getLoggerName() != null && isHidden(e.getLoggerName());
           if (currentlySelectedLoggerName == null) {
-          	//if there is no selected logger, all events should pass
-          	return true;
+          	//if there is no selected logger, pass if not hidden
+          	return !hidden;
           }
-          boolean isHidden = getHiddenSet().contains(e.getLoggerName());
-          boolean result = (e.getLoggerName() != null) && (!isHidden);
+          boolean result = (e.getLoggerName() != null) && !hidden;
 
           if (result && isFocusOnSelected())
           {
-            result = result &&  (e.getLoggerName() != null && (e.getLoggerName().startsWith(currentlySelectedLoggerName+".")
|| e.getLoggerName().endsWith(currentlySelectedLoggerName))) ;
+            result = (e.getLoggerName() != null && (e.getLoggerName().startsWith(currentlySelectedLoggerName+".")
|| e.getLoggerName().endsWith(currentlySelectedLoggerName)));
           }
 
           return result;
@@ -180,10 +180,10 @@
         {
           public boolean evaluate(LoggingEvent e)
           {
-            boolean isHidden = getHiddenSet().contains(e.getLoggerName());
+            boolean hidden = e.getLoggerName() != null && isHidden(e.getLoggerName());
             String currentlySelectedLoggerName = getCurrentlySelectedLoggerName();
 
-            if (!isFocusOnSelected() && !isHidden && currentlySelectedLoggerName
!= null && !"".equals(currentlySelectedLoggerName))
+            if (!isFocusOnSelected() && !hidden && currentlySelectedLoggerName
!= null && !"".equals(currentlySelectedLoggerName))
             {
             	return (e.getLoggerName().startsWith(currentlySelectedLoggerName+".") || e.getLoggerName().endsWith(currentlySelectedLoggerName))
;
             }
@@ -401,7 +401,7 @@
 
   /**
    * Ensures the Focus is set to a specific logger name
-   * @param logger
+   * @param
    */
   public void setFocusOn(String newLogger)
   {
@@ -424,6 +424,18 @@
     }
   }
 
+  private boolean isHidden(String loggerName) {
+    for (Iterator iter = hiddenSet.iterator();iter.hasNext();) {
+      String hiddenLoggerEntry = iter.next().toString();
+      if (loggerName.startsWith(hiddenLoggerEntry + ".") || loggerName.endsWith(hiddenLoggerEntry))
{
+          return true;
+      }
+    }
+    return false;
+  }
+
+
+
   /**
    * DOCUMENT ME!
    *
@@ -467,15 +479,6 @@
   }
 
   /**
-   * Returns an unmodifiable set of those Loggers marked as hidden.
-   * @return
-   */
-  Set getHiddenSet()
-  {
-    return Collections.unmodifiableSet(hiddenSet);
-  }
-
-  /**
    * Returns the full
    * @param path DOCUMENT ME!
    * @return
@@ -1159,7 +1162,7 @@
   private void updateHiddenSetModels() {
       DefaultListModel model = (DefaultListModel) ignoreList.getModel();
       model.clear();
-      List sortedIgnoreList = new ArrayList(getHiddenSet());
+      List sortedIgnoreList = new ArrayList(hiddenSet);
       Collections.sort(sortedIgnoreList);
 
       for (Iterator iter = sortedIgnoreList.iterator(); iter.hasNext();)
@@ -1181,6 +1184,10 @@
     hideAction.setEnabled(!isFocusOnSelected());
   }
 
+    public Collection getHiddenSet() {
+        return Collections.unmodifiableSet(hiddenSet);
+    }
+
     //~ Inner Classes ===========================================================
 
   /**



Mime
View raw message