You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@logging.apache.org by sd...@apache.org on 2010/10/14 10:01:37 UTC
svn commit: r1022406 [3/3] - in /logging/chainsaw/trunk/src/main:
java/org/apache/log4j/chainsaw/ java/org/apache/log4j/chainsaw/messages/
java/org/apache/log4j/chainsaw/vfs/ resources/org/apache/log4j/chainsaw/help/
resources/org/apache/log4j/chainsaw...
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=1022406&r1=1022405&r2=1022406&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 Thu Oct 14 08:01:36 2010
@@ -88,9 +88,11 @@ public class LogPanelPreferenceModel imp
private boolean highlightSearchMatchText;
private String hiddenExpression;
private String clearTableExpression;
- //default to cyclic mode
- private boolean cyclic = true;
+ //default to cyclic mode off
+ private boolean cyclic = false;
private boolean showMillisDeltaAsGap;
+ //default search results to visible
+ private boolean searchResultsVisible = true;
/**
* Returns an <b>unmodifiable</b> list of the columns.
@@ -248,7 +250,7 @@ public class LogPanelPreferenceModel imp
setDetailPaneVisible(model.isDetailPaneVisible());
setLogTreePanelVisible(model.isLogTreePanelVisible());
setVisibleColumnOrder(model.getVisibleColumnOrder());
-
+ setSearchResultsVisible(model.isSearchResultsVisible());
// we have to copy the list, because getColumns() is unmodifiable
setColumns(model.getColumns());
@@ -291,6 +293,16 @@ public class LogPanelPreferenceModel imp
propertySupport.firePropertyChange("levelIcons", !levelIcons, levelIcons);
}
+ public void setSearchResultsVisible(boolean searchResultsVisible) {
+ boolean oldValue = this.searchResultsVisible;
+ this.searchResultsVisible = searchResultsVisible;
+ propertySupport.firePropertyChange("searchResultsVisible", oldValue, searchResultsVisible);
+ }
+
+ public boolean isSearchResultsVisible() {
+ return searchResultsVisible;
+ }
+
/**
* @param wrapMsg
*/
Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java Thu Oct 14 08:01:36 2010
@@ -21,7 +21,6 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
@@ -206,10 +205,6 @@ public class LogPanelPreferencePanel ext
{
public void mouseClicked(MouseEvent e)
{
- if (
- (e.getClickCount() == 1)
- && ((e.getModifiers() & InputEvent.BUTTON1_MASK) > 0))
- {
int i = columnList.locationToIndex(e.getPoint());
if (i >= 0)
@@ -217,7 +212,6 @@ public class LogPanelPreferencePanel ext
Object column = columnListModel.get(i);
preferenceModel.toggleColumn(((TableColumn)column));
}
- }
}
});
columnList.setCellRenderer(cellRenderer);
@@ -537,6 +531,7 @@ public class LogPanelPreferencePanel ext
private final JCheckBox loggerTreePanel =
new JCheckBox("Show Logger Tree");
private final JCheckBox wrapMessage = new JCheckBox("Wrap message field (display multi-line rows) ");
+ private final JCheckBox searchResultsVisible = new JCheckBox("Display search results in details panel ");
private final JCheckBox highlightSearchMatchText = new JCheckBox("Highlight search match text ");
private final JCheckBox scrollToBottom =
new JCheckBox("Scroll to bottom (view tracks with new events)");
@@ -582,7 +577,7 @@ public class LogPanelPreferencePanel ext
add(scrollToBottom);
add(wrapMessage);
add(highlightSearchMatchText);
-
+ add(searchResultsVisible);
add(showMillisDeltaAsGap);
JPanel clearPanel = new JPanel(new BorderLayout());
clearPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
@@ -597,6 +592,7 @@ public class LogPanelPreferencePanel ext
toolTips.setSelected(preferenceModel.isToolTips());
thumbnailBarToolTips.setSelected(preferenceModel.isThumbnailBarToolTips());
detailPanelVisible.setSelected(preferenceModel.isDetailPaneVisible());
+ searchResultsVisible.setSelected(preferenceModel.isSearchResultsVisible());
loggerTreePanel.setSelected(preferenceModel.isLogTreePanelVisible());
}
@@ -615,6 +611,16 @@ public class LogPanelPreferencePanel ext
wrapMessage.addActionListener(wrapMessageListener);
+ ActionListener searchResultsVisibleListener = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ preferenceModel.setSearchResultsVisible(searchResultsVisible.isSelected());
+ }
+ };
+
+ searchResultsVisible.addActionListener(searchResultsVisibleListener);
+
ActionListener highlightSearchMatchTextListener = new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -635,6 +641,16 @@ public class LogPanelPreferencePanel ext
}
});
+ preferenceModel.addPropertyChangeListener(
+ "searchResultsVisible", new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ boolean value = ((Boolean) evt.getNewValue()).booleanValue();
+ searchResultsVisible.setSelected(value);
+ }
+ });
+
preferenceModel.addPropertyChangeListener(
"highlightSearchMatchText", new PropertyChangeListener()
{
Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Thu Oct 14 08:01:36 2010
@@ -55,6 +55,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
@@ -84,6 +85,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
+
import org.apache.log4j.Appender;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
@@ -209,7 +211,7 @@ public class LogUI extends JFrame implem
* the Menu bar
*/
public LogUI() {
- super("Chainsaw v2 - Log Viewer");
+ super("Chainsaw");
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
if (ChainsawIcons.WINDOW_ICON != null) {
@@ -2105,8 +2107,8 @@ public class LogUI extends JFrame implem
Iterator iter2 = panel.getMatchingEvents(rule).iterator();
while (iter2.hasNext()) {
- LoggingEvent e = (LoggingEvent) iter2.next();
- list.add(e);
+ LoggingEventWrapper e = (LoggingEventWrapper) iter2.next();
+ list.add(e.getLoggingEvent());
}
}
@@ -2133,7 +2135,11 @@ public class LogUI extends JFrame implem
try {
// we temporarily swap the TCCL so that plugins can find resources
Thread.currentThread().setContextClassLoader(classLoader);
- DOMConfigurator.configure(url);
+ try {
+ DOMConfigurator.configure(url);
+ } catch (Exception e) {
+ logger.warn("Unable to load configuration URL: " + url, e);
+ }
}finally{
// now switch it back...
Thread.currentThread().setContextClassLoader(previousTCCL);
Copied: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggingEventWrapper.java (from r1021624, logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ExtendedLoggingEvent.java)
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggingEventWrapper.java?p2=logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggingEventWrapper.java&p1=logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ExtendedLoggingEvent.java&r1=1021624&r2=1022406&rev=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ExtendedLoggingEvent.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggingEventWrapper.java Thu Oct 14 08:01:36 2010
@@ -18,100 +18,189 @@ package org.apache.log4j.chainsaw;
import java.awt.Color;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
-import org.apache.log4j.Logger;
+import org.apache.log4j.helpers.Constants;
import org.apache.log4j.rule.Rule;
import org.apache.log4j.spi.LoggingEvent;
-public class ExtendedLoggingEvent extends LoggingEvent
-{
- private static final int DEFAULT_HEIGHT = -1;
-
- private Color colorRuleBackground = ChainsawConstants.COLOR_DEFAULT_BACKGROUND;
- private Color colorRuleForeground = ChainsawConstants.COLOR_DEFAULT_FOREGROUND;
- private int markerHeight = DEFAULT_HEIGHT;
- private int msgHeight = DEFAULT_HEIGHT;
-
- private boolean searchMatch = false;
- //a Map of event fields to Sets of string matches (can be used to render matches differently)
- Map eventMatches = new HashMap();
-
- //copy constructor
- public ExtendedLoggingEvent(LoggingEvent e) {
- super(e.getFQNOfLoggerClass(), e.getLogger() != null ? e.getLogger() : Logger.getLogger(e.getLoggerName()), e.getTimeStamp(), e.getLevel(), e.getMessage(), e.getThreadName(), e.getThrowableInformation(), e.getNDC(), e.getLocationInformation(), e.getProperties());
- }
-
- public void updateColorRuleColors(Color backgroundColor, Color foregroundColor) {
- if (backgroundColor != null && foregroundColor != null) {
- this.colorRuleBackground = backgroundColor;
- this.colorRuleForeground = foregroundColor;
- } else {
- this.colorRuleBackground = ChainsawConstants.COLOR_DEFAULT_BACKGROUND;
- this.colorRuleForeground = ChainsawConstants.COLOR_DEFAULT_FOREGROUND;
- }
- }
-
- public void evaluateSearchRule(Rule searchRule) {
- eventMatches.clear();
- searchMatch = searchRule != null && searchRule.evaluate(this, eventMatches);
- }
-
- public Map getSearchMatches() {
- return eventMatches;
- }
-
- public Color getForeground() {
- return colorRuleForeground;
- }
-
- public Color getBackground() {
- return colorRuleBackground;
- }
-
- public Color getColorRuleBackground() {
- return colorRuleBackground;
- }
-
- public Color getColorRuleForeground() {
- return colorRuleForeground;
- }
-
- public boolean isSearchMatch() {
- return searchMatch;
- }
-
- public void setMarkerHeight(int markerHeight) {
- this.markerHeight = markerHeight;
- }
-
- public int getMarkerHeight() {
- return markerHeight;
- }
-
- public void setMsgHeight(int msgHeight) {
- this.msgHeight = msgHeight;
- }
-
- public int getMsgHeight() {
- return msgHeight;
- }
-
- public void setDisplayed(boolean b)
- {
- markerHeight = DEFAULT_HEIGHT;
- msgHeight = DEFAULT_HEIGHT;
- if (!b) {
- setProperty(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE, "");
- }
- }
-
- public String toString() {
- return "ExtendedLoggingEvent - id: " + getProperty("log4jid") + " background: " + getBackground() + ", foreground: " + getForeground() + ", msg: " + getMessage();
- }
-
- public void setPreviousDisplayedEventTimestamp(long previousDisplayedEventTimeStamp)
- {
- setProperty(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE, String.valueOf(timeStamp - previousDisplayedEventTimeStamp));
- }
+/**
+ * Wrap access to a LoggingEvent. All property updates need to go through this object and not through the wrapped logging event,
+ * since the properties are shared by two views of the same backing LoggingEvent, and loggingEvent itself creates a copy of passed-in properties..
+ *
+ * Property reads can be made on the actual LoggingEvent.
+ */
+public class LoggingEventWrapper {
+ private final LoggingEvent loggingEvent;
+ private static final int DEFAULT_HEIGHT = -1;
+
+ private Color colorRuleBackground = ChainsawConstants.COLOR_DEFAULT_BACKGROUND;
+ private Color colorRuleForeground = ChainsawConstants.COLOR_DEFAULT_FOREGROUND;
+ private int markerHeight = DEFAULT_HEIGHT;
+ private int msgHeight = DEFAULT_HEIGHT;
+
+ //set to the log4jid value via setId - assumed to never change
+ private int id;
+
+ private boolean searchMatch = false;
+ //a Map of event fields to Sets of string matches (can be used to render matches differently)
+ Map eventMatches = new HashMap();
+ private LoggingEventWrapper syncWrapper;
+ private EventContainer eventContainer;
+
+ public LoggingEventWrapper(LoggingEvent loggingEvent, EventContainer eventContainer) {
+ this.loggingEvent = loggingEvent;
+ this.eventContainer = eventContainer;
+ }
+
+ public LoggingEventWrapper(LoggingEventWrapper loggingEventWrapper, EventContainer eventContainer) {
+ this.loggingEvent = loggingEventWrapper.getLoggingEvent();
+ this.id = loggingEventWrapper.id;
+ this.syncWrapper = loggingEventWrapper;
+ this.eventContainer = eventContainer;
+ loggingEventWrapper.syncWrapper = this;
+ Map theseProperties = loggingEvent.getProperties();
+
+ LoggingEvent thatLoggingEvent = syncWrapper.getLoggingEvent();
+ Map syncEventPropertiesCopy = new HashMap(thatLoggingEvent.getProperties());
+ for (Iterator iter = syncEventPropertiesCopy.entrySet().iterator();iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ thatLoggingEvent.removeProperty(entry.getKey().toString());
+ }
+
+ for (Iterator iter = theseProperties.entrySet().iterator();iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ thatLoggingEvent.setProperty(entry.getKey().toString(), entry.getValue().toString());
+ }
+ }
+
+ public LoggingEvent getLoggingEvent() {
+ return loggingEvent;
+ }
+
+ public void setProperty(String propName, String propValue) {
+ loggingEvent.setProperty(propName, propValue);
+ if (propName.equals(Constants.LOG4J_ID_KEY)) {
+ id = Integer.parseInt(propValue);
+ }
+ if (!propName.equals(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE)) {
+ eventContainer.reFilter();
+ }
+ if (syncWrapper != null && !propName.equals(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE)) {
+ syncWrapper.getLoggingEvent().setProperty(propName, propValue);
+ EventContainer syncWrapperEventContainer = syncWrapper.eventContainer;
+ syncWrapperEventContainer.reFilter();
+ }
+ }
+
+ public Object removeProperty(String propName) {
+ Object result = loggingEvent.removeProperty(propName);
+ if (!propName.equals(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE)) {
+ eventContainer.reFilter();
+ }
+ if (syncWrapper != null && !propName.equals(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE)) {
+ syncWrapper.getLoggingEvent().removeProperty(propName);
+ EventContainer syncWrapperEventContainer = syncWrapper.eventContainer;
+ syncWrapperEventContainer.reFilter();
+ }
+ return result;
+ }
+
+ public Set getPropertyKeySet() {
+ return loggingEvent.getPropertyKeySet();
+ }
+
+ public void updateColorRuleColors(Color backgroundColor, Color foregroundColor) {
+ if (backgroundColor != null && foregroundColor != null) {
+ this.colorRuleBackground = backgroundColor;
+ this.colorRuleForeground = foregroundColor;
+ } else {
+ this.colorRuleBackground = ChainsawConstants.COLOR_DEFAULT_BACKGROUND;
+ this.colorRuleForeground = ChainsawConstants.COLOR_DEFAULT_FOREGROUND;
+ }
+ }
+
+ public void evaluateSearchRule(Rule searchRule) {
+ eventMatches.clear();
+ searchMatch = searchRule != null && searchRule.evaluate(loggingEvent, eventMatches);
+ }
+
+ public Map getSearchMatches() {
+ return eventMatches;
+ }
+
+ public Color getForeground() {
+ return colorRuleForeground;
+ }
+
+ public Color getBackground() {
+ return colorRuleBackground;
+ }
+
+ public Color getColorRuleBackground() {
+ return colorRuleBackground;
+ }
+
+ public Color getColorRuleForeground() {
+ return colorRuleForeground;
+ }
+
+ public boolean isSearchMatch() {
+ return searchMatch;
+ }
+
+ public void setMarkerHeight(int markerHeight) {
+ this.markerHeight = markerHeight;
+ }
+
+ public int getMarkerHeight() {
+ return markerHeight;
+ }
+
+ public void setMsgHeight(int msgHeight) {
+ this.msgHeight = msgHeight;
+ }
+
+ public int getMsgHeight() {
+ return msgHeight;
+ }
+
+ public void setDisplayed(boolean b) {
+ markerHeight = DEFAULT_HEIGHT;
+ msgHeight = DEFAULT_HEIGHT;
+ if (!b) {
+ setProperty(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE, "");
+ }
+ }
+
+ public void setPreviousDisplayedEventTimestamp(long previousDisplayedEventTimeStamp) {
+ setProperty(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE, String.valueOf(loggingEvent.getTimeStamp() - previousDisplayedEventTimeStamp));
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ LoggingEventWrapper that = (LoggingEventWrapper) o;
+
+ if (id != that.id) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return id;
+ }
+
+ public String toString() {
+ return "LoggingEventWrapper - id: " + id + " background: " + getBackground() + ", foreground: " + getForeground() + ", msg: " + loggingEvent.getMessage();
+ }
}
Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/RuleMediator.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/RuleMediator.java?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/RuleMediator.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/RuleMediator.java Thu Oct 14 08:01:36 2010
@@ -30,87 +30,56 @@ import org.apache.log4j.spi.LoggingEvent
* A mediator class that implements the Rule interface, by combining several
* optional rules used by Chainsaw's filtering GUI's into a single Rule.
*
- * <p>This class is based upon the concept of Inclusion, Exclusion and Refinement.
- * By default, this class accepts all events by returning true as part of the
- * Rule interface, unless the Inclusion/Exclusion/Refinement sub-rules have been
- * configured.
- *
- * <p>The sub-rules are queried in this order: Inclusion, Refinement, Exclusion.
- * If any are null, that particular sub-rule is not queried. If any of the
- * sub-rules returns false, this mediator returns false immediately, otherwise
- * they are queried in that order to ensure the overall rule evaluates.
- *
- * <p>Setting the individual sub-rules propagates a PropertyChangeEvent as per
+ * <p>Setting the individual sub-rules propagates a PropertyChangeEvent as per
* standard Java beans principles.
*
* @author Paul Smith <ps...@apache.org>
* @author Scott Deboy <sd...@apache.org>
*/
-public class RuleMediator extends AbstractRule implements Rule {
- private Rule inclusionRule;
+public class RuleMediator extends AbstractRule {
private Rule loggerRule;
- private Rule refinementRule;
- private Rule exclusionRule;
- private final PropertyChangeListener ruleChangerNotifier =
- new RuleChangerNotifier();
+ private Rule filterRule;
+ private Rule findRule;
+ private final PropertyChangeListener ruleChangerNotifier = new RuleChangerNotifier();
+ private boolean findRuleRequired;
+ public RuleMediator(boolean findRuleRequired) {
+ this.findRuleRequired = findRuleRequired;
+ }
/* (non-Javadoc)
* @see org.apache.log4j.chainsaw.rule.Rule#evaluate(org.apache.log4j.spi.LoggingEvent)
*/
public boolean evaluate(LoggingEvent e, Map matches) {
- boolean accepts = true;
-
- //no need to have rulemediator build matches
- if (inclusionRule != null) {
- accepts = inclusionRule.evaluate(e, null);
+ if (findRuleRequired) {
+ if (findRule == null) {
+ return false;
+ }
+ if (!findRule.evaluate(e, null)) {
+ return false;
+ }
}
- if (!accepts) {
+ if (loggerRule != null && !loggerRule.evaluate(e, null)) {
return false;
}
- if (loggerRule != null) {
- accepts = loggerRule.evaluate(e, null);
- }
-
- if (!accepts) {
+ if (filterRule != null && !filterRule.evaluate(e, null)) {
return false;
}
- if (refinementRule != null) {
- accepts = refinementRule.evaluate(e, null);
- }
-
- if (!accepts) {
- return false;
- }
-
- if (exclusionRule != null) {
- accepts = exclusionRule.evaluate(e, null);
- }
-
- return accepts;
+ return true;
}
- /**
- * Sets the Inclusion rule to be used, and fires a PropertyChangeEvent to listeners
- * @param r
- */
- public void setInclusionRule(Rule r) {
- Rule oldRule = this.inclusionRule;
- this.inclusionRule = r;
- firePropertyChange("inclusionRule", oldRule, this.inclusionRule);
+ public void setFilterRule(Rule r) {
+ Rule oldFilterRule = this.filterRule;
+ this.filterRule = r;
+ firePropertyChange("filterRule", oldFilterRule, this.filterRule);
}
- /**
- * Sets the Refinement rule to be used, and fires a PropertyChangeEvent to listeners
- * @param r
- */
- public void setRefinementRule(Rule r) {
- Rule oldRefinementRule = this.refinementRule;
- this.refinementRule = r;
- firePropertyChange(
- "refinementRule", oldRefinementRule, this.refinementRule);
+ public void setFindRule(Rule r) {
+ Rule oldFindRule = this.findRule;
+ this.findRule = r;
+ firePropertyChange("findRule", oldFindRule, this.findRule);
}
public void setLoggerRule(Rule r) {
@@ -124,45 +93,6 @@ public class RuleMediator extends Abstra
}
/**
- * Sets the Exclusion rule to be used, and fires a PropertyChangeEvent to listeners.
- *
- * @param r
- */
- public void setExclusionRule(Rule r) {
- Rule oldExclusionRule = this.exclusionRule;
- this.exclusionRule = r;
- firePropertyChange("exclusionRule", oldExclusionRule, this.exclusionRule);
- }
-
- /**
- * @return exclusion rule
- */
- public final Rule getExclusionRule() {
- return exclusionRule;
- }
-
- /**
- * @return inclusion rule
- */
- public final Rule getInclusionRule() {
- return inclusionRule;
- }
-
- /**
- * @return logger rule
- */
- public final Rule getLoggerRule() {
- return loggerRule;
- }
-
- /**
- * @return refinement rule
- */
- public final Rule getRefinementRule() {
- return refinementRule;
- }
-
- /**
* Helper class that propagates internal Rules propertyChange events
* to external parties, since an internal rule changing really means
* this outter rule is going to change too.
Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java Thu Oct 14 08:01:36 2010
@@ -70,7 +70,6 @@ import org.apache.log4j.chainsaw.color.R
import org.apache.log4j.chainsaw.icons.LevelIconFactory;
import org.apache.log4j.helpers.Constants;
import org.apache.log4j.rule.Rule;
-import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.spi.LoggingEventFieldResolver;
@@ -97,7 +96,7 @@ public class TableColorizingRenderer ext
private boolean useRelativeTimesToFixedTime = false;
private long relativeTimestampBase;
- private static int borderWidth = 2;
+ private static int borderWidth = ChainsawConstants.TABLE_BORDER_WIDTH;
private final Color borderColor;
@@ -116,15 +115,18 @@ public class TableColorizingRenderer ext
private EventContainer eventContainer;
private LogPanelPreferenceModel logPanelPreferenceModel;
private SimpleAttributeSet insetAttributeSet;
+ private boolean colorizeSearch;
- /**
+ /**
* Creates a new TableColorizingRenderer object.
*/
public TableColorizingRenderer(RuleColorizer colorizer, ApplicationPreferenceModel applicationPreferenceModel,
- EventContainer eventContainer, LogPanelPreferenceModel logPanelPreferenceModel) {
+ EventContainer eventContainer, LogPanelPreferenceModel logPanelPreferenceModel,
+ boolean colorizeSearch) {
this.applicationPreferenceModel = applicationPreferenceModel;
this.logPanelPreferenceModel = logPanelPreferenceModel;
this.eventContainer = eventContainer;
+ this.colorizeSearch = colorizeSearch;
multiLinePanel.setLayout(new BoxLayout(multiLinePanel, BoxLayout.Y_AXIS));
generalPanel.setLayout(new BoxLayout(generalPanel, BoxLayout.Y_AXIS));
levelPanel.setLayout(new BoxLayout(levelPanel, BoxLayout.Y_AXIS));
@@ -176,27 +178,26 @@ public class TableColorizingRenderer ext
final JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int col) {
EventContainer container = (EventContainer) table.getModel();
- ExtendedLoggingEvent loggingEvent = container.getRow(row);
- value = formatField(value, row, loggingEvent);
+ LoggingEventWrapper loggingEventWrapper = container.getRow(row);
+ value = formatField(value, row, loggingEventWrapper);
TableColumn tableColumn = table.getColumnModel().getColumn(col);
int width = tableColumn.getWidth();
-
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value,
isSelected, hasFocus, row, col);
//chainsawcolumns uses one-based indexing
int colIndex = tableColumn.getModelIndex() + 1;
//no event, use default renderer
- if (loggingEvent == null) {
+ if (loggingEventWrapper == null) {
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
}
long delta = 0;
if (row > 0) {
- LoggingEvent previous = eventContainer.getRow(row - 1);
- delta = Math.min(ChainsawConstants.MILLIS_DELTA_RENDERING_HEIGHT_MAX, Math.max(0, (long) ((loggingEvent.getTimeStamp() - previous.getTimeStamp()) * ChainsawConstants.MILLIS_DELTA_RENDERING_FACTOR)));
+ LoggingEventWrapper previous = eventContainer.getRow(row - 1);
+ delta = Math.min(ChainsawConstants.MILLIS_DELTA_RENDERING_HEIGHT_MAX, Math.max(0, (long) ((loggingEventWrapper.getLoggingEvent().getTimeStamp() - previous.getLoggingEvent().getTimeStamp()) * ChainsawConstants.MILLIS_DELTA_RENDERING_FACTOR)));
}
- Map matches = loggingEvent.getSearchMatches();
+ Map matches = loggingEventWrapper.getSearchMatches();
JComponent component;
switch (colIndex) {
@@ -329,8 +330,8 @@ public class TableColorizingRenderer ext
textPane.setBorder(getMiddleBorder(isSelected, 0));
}
}
- int currentMarkerHeight = loggingEvent.getMarkerHeight();
- int currentMsgHeight = loggingEvent.getMsgHeight();
+ int currentMarkerHeight = loggingEventWrapper.getMarkerHeight();
+ int currentMsgHeight = loggingEventWrapper.getMsgHeight();
int newRowHeight = ChainsawConstants.DEFAULT_ROW_HEIGHT;
boolean setHeight = false;
@@ -355,15 +356,15 @@ public class TableColorizingRenderer ext
}
if (colIndex == ChainsawColumns.INDEX_LOG4J_MARKER_COL_NAME) {
- loggingEvent.setMarkerHeight(newRowHeight);
- if (newRowHeight != currentMarkerHeight && newRowHeight >= loggingEvent.getMsgHeight()) {
+ loggingEventWrapper.setMarkerHeight(newRowHeight);
+ if (newRowHeight != currentMarkerHeight && newRowHeight >= loggingEventWrapper.getMsgHeight()) {
setHeight = true;
}
}
if (colIndex == ChainsawColumns.INDEX_MESSAGE_COL_NAME) {
- loggingEvent.setMsgHeight(newRowHeight);
- if (newRowHeight != currentMsgHeight && newRowHeight >= loggingEvent.getMarkerHeight()) {
+ loggingEventWrapper.setMsgHeight(newRowHeight);
+ if (newRowHeight != currentMsgHeight && newRowHeight >= loggingEventWrapper.getMarkerHeight()) {
setHeight = true;
}
}
@@ -398,7 +399,7 @@ public class TableColorizingRenderer ext
//remaining entries are properties
default:
- Set propertySet = loggingEvent.getPropertyKeySet();
+ Set propertySet = loggingEventWrapper.getPropertyKeySet();
String headerName = tableColumn.getHeaderValue().toString().toLowerCase();
String thisProp = null;
//find the property in the property set...case-sensitive
@@ -412,7 +413,7 @@ public class TableColorizingRenderer ext
if (thisProp != null) {
String propKey = LoggingEventFieldResolver.PROP_FIELD + thisProp.toUpperCase();
Set propKeyMatches = (Set)matches.get(propKey);
- singleLineTextPane.setText(loggingEvent.getProperty(thisProp));
+ singleLineTextPane.setText(loggingEventWrapper.getLoggingEvent().getProperty(thisProp));
setHighlightAttributesInternal(propKeyMatches, (StyledDocument) singleLineTextPane.getDocument());
} else {
singleLineTextPane.setText("");
@@ -426,12 +427,17 @@ public class TableColorizingRenderer ext
Color foreground;
Rule loggerRule = colorizer.getLoggerRule();
//use logger colors in table instead of event colors if event passes logger rule
- if (loggerRule != null && loggerRule.evaluate(loggingEvent, null)) {
+ if (loggerRule != null && loggerRule.evaluate(loggingEventWrapper.getLoggingEvent(), null)) {
background = applicationPreferenceModel.getSearchBackgroundColor();
foreground = applicationPreferenceModel.getSearchForegroundColor();
} else {
- background = loggingEvent.isSearchMatch()?applicationPreferenceModel.getSearchBackgroundColor():loggingEvent.getBackground();
- foreground = loggingEvent.isSearchMatch()?applicationPreferenceModel.getSearchForegroundColor():loggingEvent.getForeground();
+ if (colorizeSearch) {
+ background = loggingEventWrapper.isSearchMatch()?applicationPreferenceModel.getSearchBackgroundColor():loggingEventWrapper.getBackground();
+ foreground = loggingEventWrapper.isSearchMatch()?applicationPreferenceModel.getSearchForegroundColor():loggingEventWrapper.getForeground();
+ } else {
+ background = loggingEventWrapper.getBackground();
+ foreground = loggingEventWrapper.getForeground();
+ }
}
/**
@@ -566,7 +572,7 @@ public class TableColorizingRenderer ext
* @param renderingRow
* @return formatted object
*/
- private Object formatField(Object field, int renderingRow, ExtendedLoggingEvent loggingEvent) {
+ private Object formatField(Object field, int renderingRow, LoggingEventWrapper loggingEventWrapper) {
if (!(field instanceof Date)) {
return (field == null ? "" : field);
}
@@ -576,7 +582,7 @@ public class TableColorizingRenderer ext
return "" + (((Date)field).getTime() - relativeTimestampBase);
}
if (useRelativeTimesToPrevious) {
- return loggingEvent.getProperty(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE);
+ return loggingEventWrapper.getLoggingEvent().getProperty(ChainsawConstants.MILLIS_DELTA_COL_NAME_LOWERCASE);
}
return dateFormatInUse.format((Date) field);
Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/messages/MessageCenter.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/messages/MessageCenter.java?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/messages/MessageCenter.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/messages/MessageCenter.java Thu Oct 14 08:01:36 2010
@@ -45,10 +45,10 @@ import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.TTCCLayout;
import org.apache.log4j.chainsaw.ChainsawConstants;
+import org.apache.log4j.chainsaw.LoggingEventWrapper;
import org.apache.log4j.chainsaw.PopupListener;
import org.apache.log4j.chainsaw.SmallButton;
import org.apache.log4j.chainsaw.icons.ChainsawIcons;
-import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.varia.ListModelAppender;
@@ -242,7 +242,7 @@ public class MessageCenter {
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
- value = layout.format((LoggingEvent) value);
+ value = layout.format(((LoggingEventWrapper) value).getLoggingEvent());
Component c =
super.getListCellRendererComponent(
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=1022406&r1=1022405&r2=1022406&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 Thu Oct 14 08:01:36 2010
@@ -303,7 +303,7 @@ public class VFSLogFilePatternReceiver e
}}).start();
} else {
String oldURL = getFileURL();
- if (oldURL != null) {
+ if (oldURL != null && oldURL.indexOf("://") > -1) {
int index = oldURL.indexOf("://");
String lastPart = oldURL.substring(index + "://".length());
int passEndIndex = lastPart.indexOf("@");
Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html (original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html Thu Oct 14 08:01:36 2010
@@ -14,6 +14,10 @@
<ul>
<li>Changed 'Wrap message field' preference default to true</li>
</ul>
+<h2>13 Oct 2010</h2>
+<ul>
+<li>Added log panel preference to display search results in the detail panel. When the preference is enabled and a search is performed, the matching rows are displayed in a table in the details panel. Clicking on a row in that table selects the row in the main event table.</li>
+</ul>
<h2>15 Sep 2010</h2>
<ul>
<li>New feature: Clickable thumbnail bar on the left shows time delta to prior displayed event if the time delta is > 1 second (behaves similarly to the thumbnail bar on the right which shows colors and search matches, but represents the time delta between events). A bigger delta is represented as a wider line.</li>
@@ -502,4 +506,4 @@ not to provide this, be on the look out
<li>The first version we decided we needed to have some release notes in... :)</li>
<li>Fix for LoggingEvent class - connecting Chainsaw v2 to a remote log4j1.2.x caused a NullPointerException</li>
</ul>
-</body></html>
\ No newline at end of file
+</body></html>
Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties?rev=1022406&r1=1022405&r2=1022406&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties (original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties Thu Oct 14 08:01:36 2010
@@ -42,4 +42,5 @@ scrollToBottom=true
logTreePanelVisible=true
detailPaneVisible=true
highlightSearchMatchText=true
-wrapMessage=true
\ No newline at end of file
+wrapMessage=true
+searchResultsVisible=true
\ No newline at end of file