[logback-dev] svn commit: r1645 - in logback/trunk: logback-core/src/test/java/ch/qos/logback/core/pattern/parser logback-site/src/site/pages logback-site/src/site/pages/manual
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Thu Mar 13 17:55:09 CET 2008
Author: ceki
Date: Thu Mar 13 17:55:08 2008
New Revision: 1645
Modified:
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
logback/trunk/logback-site/src/site/pages/manual/layouts.html
logback/trunk/logback-site/src/site/pages/news.html
Log:
- documenting and further testing parentheses support (bug 83)
- updating news
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java Thu Mar 13 17:55:08 2008
@@ -42,9 +42,25 @@
//StatusManager sm = context.getStatusManager();
//StatusPrinter.print(sm);
assertEquals("x123", s);
+ }
+
+ public void testParentheses() {
+ PatternLayoutBase<Object> plb = getPatternLayoutBase();
+ Context context = new ContextBase();
+ plb.setContext(context);
+ plb.setPattern("x(%OTT\\)");
+ plb.start();
+ String s = plb.doLayout(new Object());
+ //System.out.println(s);
+ System.out.println(s);
+
+ //StatusManager sm = context.getStatusManager();
+ //StatusPrinter.print(sm);
+ assertEquals("x(123)", s);
}
+
@Override
public Context getContext() {
return context;
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java Thu Mar 13 17:55:08 2008
@@ -281,35 +281,42 @@
}
public void testNested() throws ScanException {
+ List tl = new TokenStream("%(%a%(%b))").tokenize();
+ List<Token> witness = new ArrayList<Token>();
+ witness.add(Token.PERCENT_TOKEN);
+ witness.add(Token.LEFT_PARENTHESIS_TOKEN);
+ witness.add(Token.PERCENT_TOKEN);
+ witness.add(new Token(Token.KEYWORD, "a"));
+ witness.add(Token.PERCENT_TOKEN);
+ witness.add(Token.LEFT_PARENTHESIS_TOKEN);
+ witness.add(Token.PERCENT_TOKEN);
+ witness.add(new Token(Token.KEYWORD, "b"));
+ witness.add(Token.RIGHT_PARENTHESIS_TOKEN);
+ witness.add(Token.RIGHT_PARENTHESIS_TOKEN);
+
+ assertEquals(witness, tl);
+
+ }
+
+ public void testEscapedParanteheses() throws ScanException {
{
- List tl = new TokenStream("%(%a%(%b))").tokenize();
+ List tl = new TokenStream("\\(%h\\)").tokenize();
List<Token> witness = new ArrayList<Token>();
+ witness.add(new Token(Token.LITERAL, "("));
witness.add(Token.PERCENT_TOKEN);
- witness.add(Token.LEFT_PARENTHESIS_TOKEN);
- witness.add(Token.PERCENT_TOKEN);
- witness.add(new Token(Token.KEYWORD, "a"));
- witness.add(Token.PERCENT_TOKEN);
- witness.add(Token.LEFT_PARENTHESIS_TOKEN);
- witness.add(Token.PERCENT_TOKEN);
- witness.add(new Token(Token.KEYWORD, "b"));
- witness.add(Token.RIGHT_PARENTHESIS_TOKEN);
- witness.add(Token.RIGHT_PARENTHESIS_TOKEN);
-
+ witness.add(new Token(Token.KEYWORD, "h"));
+ witness.add(new Token(Token.LITERAL, ")"));
assertEquals(witness, tl);
}
-
{
- List tl = new TokenStream("\\(%h\\)").tokenize();
+ List tl = new TokenStream("(%h\\)").tokenize();
List<Token> witness = new ArrayList<Token>();
witness.add(new Token(Token.LITERAL, "("));
witness.add(Token.PERCENT_TOKEN);
witness.add(new Token(Token.KEYWORD, "h"));
witness.add(new Token(Token.LITERAL, ")"));
-
assertEquals(witness, tl);
}
- //
}
-
}
\ No newline at end of file
Modified: logback/trunk/logback-site/src/site/pages/manual/layouts.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/layouts.html (original)
+++ logback/trunk/logback-site/src/site/pages/manual/layouts.html Thu Mar 13 17:55:08 2008
@@ -998,6 +998,19 @@
</tr>
</table>
+ <h3>Parentheses are special</h3>
+
+ <p>In logback, parentheses withing the pattern string are treated
+ as grouping tokens. Thus, it is possible to group a sub-pattern
+ and apply formatting directives to that sub-pattern.
+ </p>
+
+ <p>For example,
+
+ <span class="red"><b>XXXXXXXXXXXXXXXXXX</b></span>
+
+
+
<h3>Options</h3>
<p>
Modified: logback/trunk/logback-site/src/site/pages/news.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/news.html (original)
+++ logback/trunk/logback-site/src/site/pages/news.html Thu Mar 13 17:55:08 2008
@@ -60,8 +60,6 @@
client connections and to close them.
</p>
-
-
<p>Fixed <a href="http://bugzilla.qos.ch/show_bug.cgi?id=110">bug
110</a> in relation with the <code>requestParameterMap</code> field
in <code>AccessEvent</code> - reported by Joern Huxhorn.
@@ -77,6 +75,20 @@
nested as well as multiple file inclusions.
</p>
+ <p>Fixed <a href="http://bugzilla.qos.ch/show_bug.cgi?id=100">bug
+ 100</a> reported by Joern Huxhorn. At serialization time, object
+ array passed as parameter, when the LoggingEvent is are now
+ serialized as strings.
+ </p>
+
+
+ <p>Fixed <a href="http://bugzilla.qos.ch/show_bug.cgi?id=109">bug
+ 109</a> reported by Joern Huxhorn. There should no longer be any
+ NullPointerExceptions thrown by deserialized
+ <code>AccessEvent</code> instances.
+
+ </p>
+
<hr width="80%" align="center" />
More information about the logback-dev
mailing list