You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by sd...@apache.org on 2004/07/22 08:27:40 UTC
cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw/help tutorial.html release-notes.html
sdeboy 2004/07/21 23:27:40
Modified: src/java/org/apache/log4j/rule ExpressionRule.java
src/java/org/apache/log4j/chainsaw/help tutorial.html
release-notes.html
Log:
Added support for shortcutting MSG ~= expressions by using a single word or a single-quote delimited phrase as the expression (see tutorial for more information).
Revision Changes Path
1.7 +10 -0 logging-log4j/src/java/org/apache/log4j/rule/ExpressionRule.java
Index: ExpressionRule.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rule/ExpressionRule.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ExpressionRule.java 27 Feb 2004 16:47:33 -0000 1.6
+++ ExpressionRule.java 22 Jul 2004 06:27:40 -0000 1.7
@@ -111,6 +111,16 @@
stack.push(token);
}
}
+
+ if ((stack.size() == 1) && (!(stack.peek() instanceof Rule))) {
+ //while this may be an attempt at creating an expression,
+ //for ease of use, convert this single entry to a partial-text
+ //match on the MSG field
+ Object o = stack.pop();
+ stack.push("MSG");
+ stack.push(o);
+ return factory.getRule("~=", stack);
+ }
//stack should contain a single rule if the expression is valid
if ((stack.size() != 1) || (!(stack.peek() instanceof Rule))) {
1.13 +6 -0 logging-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html
Index: tutorial.html
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- tutorial.html 20 Jun 2004 07:28:53 -0000 1.12
+++ tutorial.html 22 Jul 2004 06:27:40 -0000 1.13
@@ -174,6 +174,12 @@
<tr><td align="center">!</td><td>logical not</td></tr>
</table>
+<p><b>Expression shortcut:</b></p>
+<ul>
+<li>Since it is very common need to perform a case-insensitive partial-text match against the Message field, any single word or any single phrase (the phrase must be delimited by single-quote marks) will act as a rule defined using the MSG ~= syntax.</li>
+<li>Example: to search the Message field for the phrase 'logged in', instead of defining the expression <b>MSG ~= 'logged in'</b>, use <b>'logged in'</b> by itself (including the single quotes). Instead of using <b>MSG ~= evaluation</b> to search for the word 'evaluation', use <b>evaluation</b> by itself (no need for single quotes since it's a single word).</li>
+</ul>
+
<p><b>Operator limitations:</b></p>
<ul>
<li>Inequality operators are supported for Levels (<b>LEVEL > info</b>) and anything that can be converted to a numeric value (including timestamps).</li>
1.31 +1 -0 logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
Index: release-notes.html
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- release-notes.html 20 Jul 2004 22:22:27 -0000 1.30
+++ release-notes.html 22 Jul 2004 06:27:40 -0000 1.31
@@ -11,6 +11,7 @@
<h2>21 July 2004</h2>
<ul>
+ <li>Added support for shortcutting MSG ~= expressions by using a single word or a single-quote delimited phrase as the expression (see tutorial for more information).</li>
<li>Applied patch from Stephen Pain which modifies the FileSaveAction so that only the currently viewable (or filtered) events
are saved in the file.</li>
</ul>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org