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/04/06 09:42:09 UTC
svn commit: r931040 - in /logging/chainsaw/trunk/src/main:
java/org/apache/log4j/chainsaw/JSortTable.java
java/org/apache/log4j/chainsaw/LogPanel.java
resources/org/apache/log4j/chainsaw/help/release-notes.html
Author: sdeboy
Date: Tue Apr 6 07:42:08 2010
New Revision: 931040
URL: http://svn.apache.org/viewvc?rev=931040&view=rev
Log:
Pressing enter in the search box now initiates a search
Updated Thumbnail rendering logic to display warnings, errors, fatal events and events with markers more prominently than other events
Updated table.scrollTo logic to keep requested row off the bottom and top of the range of displayed rows
Modified:
logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java
logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java?rev=931040&r1=931039&r2=931040&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java Tue Apr 6 07:42:08 2010
@@ -99,6 +99,9 @@ public class JSortTable extends JTable i
if ((row > -1) && (row < getRowCount())) {
try {
setRowSelectionInterval(row, row);
+ //get the requested row off of the bottom and top of the screen by making the 5 rows around the requested row visible
+ scrollRectToVisible(getCellRect(row + 5, col, true));
+ scrollRectToVisible(getCellRect(row - 5, col, true));
scrollRectToVisible(getCellRect(row, col, true));
} catch (IllegalArgumentException iae) {
//ignore..out of bounds
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=931040&r1=931039&r2=931040&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 Tue Apr 6 07:42:08 2010
@@ -125,6 +125,7 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.text.Document;
+import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
@@ -2226,7 +2227,11 @@ public class LogPanel extends DockablePa
findField.setMinimumSize(findSize);
findPanel.setAlignmentY(Component.CENTER_ALIGNMENT);
findField.setAlignmentY(Component.CENTER_ALIGNMENT);
-
+ findField.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ findNext();
+ }
+ });
findField.addKeyListener(
new ExpressionRuleContext(filterModel, findField));
@@ -3208,6 +3213,7 @@ public class LogPanel extends DockablePa
}
// System.out.println("update - new warnings: " + warnings.size() + ", errors: " + errors.size());
}
+ invalidate();
repaint();
}
});
@@ -3253,6 +3259,7 @@ public class LogPanel extends DockablePa
all.add(wrapper);
}
}
+ invalidate();
repaint();
}
@@ -3298,14 +3305,44 @@ public class LogPanel extends DockablePa
int componentHeight = height - minHeight;
int eventHeight = minHeight;
+ //draw all non error/warning/marker events
+ for (Iterator iter = all.iterator();iter.hasNext();) {
+ EventWrapper wrapper = (EventWrapper)iter.next();
+ if (!wrapper.loggingEvent.getColorRuleBackground().equals(ChainsawConstants.COLOR_DEFAULT_BACKGROUND)) {
+ if (wrapper.loggingEvent.getLevel().toInt() < Level.WARN.toInt() && wrapper.loggingEvent.getProperty(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE) == null) {
+ float ratio = (wrapper.rowNum / (float)rowCount);
+ // System.out.println("error - ratio: " + ratio + ", component height: " + componentHeight);
+ int verticalLocation = (int) (componentHeight * ratio) + topOffset;
+
+ int startX = 1;
+ int width = getWidth() - (startX * 2);
+
+ drawEvent(wrapper.loggingEvent.getColorRuleBackground(), verticalLocation, eventHeight, g, startX, width);
+ // System.out.println("painting error - rownum: " + wrapper.rowNum + ", location: " + verticalLocation + ", height: " + eventHeight + ", component height: " + componentHeight + ", row count: " + rowCount);
+ }
+ }
+ }
+
+ //draw warnings, error, fatal & markers last (full width)
for (Iterator iter = all.iterator();iter.hasNext();) {
EventWrapper wrapper = (EventWrapper)iter.next();
if (!wrapper.loggingEvent.getColorRuleBackground().equals(ChainsawConstants.COLOR_DEFAULT_BACKGROUND)) {
- float ratio = (wrapper.rowNum / (float)rowCount);
- // System.out.println("error - ratio: " + ratio + ", component height: " + componentHeight);
- int verticalLocation = (int) (componentHeight * ratio) + topOffset;
- drawEvent(wrapper.loggingEvent.getColorRuleBackground(), verticalLocation, eventHeight, g, false);
+ if (wrapper.loggingEvent.getLevel().toInt() >= Level.WARN.toInt() || wrapper.loggingEvent.getProperty(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE) != null) {
+ float ratio = (wrapper.rowNum / (float)rowCount);
+ // System.out.println("error - ratio: " + ratio + ", component height: " + componentHeight);
+ int verticalLocation = (int) (componentHeight * ratio) + topOffset;
+
+ int startX = 1;
+ int width = getWidth() - (startX * 2);
+ //narrow the color a bit if level is less than warn
+ //make warnings, errors a little taller
+
+ eventHeight = Math.min(maxEventHeight, eventHeight + 3);
+// eventHeight = maxEventHeight;
+
+ drawEvent(wrapper.loggingEvent.getColorRuleBackground(), (verticalLocation - eventHeight + 1), eventHeight, g, startX, width);
// System.out.println("painting error - rownum: " + wrapper.rowNum + ", location: " + verticalLocation + ", height: " + eventHeight + ", component height: " + componentHeight + ", row count: " + rowCount);
+ }
}
}
@@ -3314,19 +3351,19 @@ public class LogPanel extends DockablePa
float ratio = (wrapper.rowNum / (float)rowCount);
// System.out.println("warning - ratio: " + ratio + ", component height: " + componentHeight);
int verticalLocation = (int) (componentHeight * ratio) + topOffset;
- drawEvent(wrapper.loggingEvent.getBackground(), verticalLocation, eventHeight, g, true);
+
+ int startX = 1;
+ int width = getWidth() - (startX * 2);
+ width = (width / 2);
+
+ drawEvent(wrapper.loggingEvent.getBackground(), verticalLocation, eventHeight, g, startX, width);
// System.out.println("painting warning - rownum: " + wrapper.rowNum + ", location: " + verticalLocation + ", height: " + eventHeight + ", component height: " + componentHeight + ", row count: " + rowCount);
}
}
- private void drawEvent(Color newColor, int verticalLocation, int eventHeight, Graphics g, boolean drawHalfWidth) {
+ private void drawEvent(Color newColor, int verticalLocation, int eventHeight, Graphics g, int x, int width) {
// System.out.println("painting: - color: " + newColor + ", verticalLocation: " + verticalLocation + ", eventHeight: " + eventHeight);
- int x = 1;
- int width = getWidth() - (x * 2);
- if (drawHalfWidth) {
- width = (width/2);
- }
- //center drawing at vertical location
+ //center drawing at vertical location
int y = verticalLocation + (eventHeight / 2);
Color oldColor = g.getColor();
g.setColor(newColor);
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=931040&r1=931039&r2=931040&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 Tue Apr 6 07:42:08 2010
@@ -10,6 +10,11 @@
<b>NOTE:</b> The mechanism and format used to persist settings in Chainsaw is subject to change. If you are experiencing problems displaying events in Chainsaw, please delete everything in the $user.dir/.chainsaw directory and restart Chainsaw.
<br>
<h1>1.99.99</h1>
+<h2>6 Apr 2010</h2>
+<ul>
+<li>Pressing enter in the search box now initiates a search.</li>
+<li>Updated thumbnail rendering logic to display warnings, errors, fatal events and events with markers more prominently than other events.</li>
+</ul>
<h2>3 Apr 2010</h2>
<ul>
<li>