
Author: ceki Date: Thu Feb 5 22:25:21 2009 New Revision: 2145 Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java logback/trunk/logback-site/src/site/pages/faq.html logback/trunk/logback-site/src/site/pages/manual/appenders.html logback/trunk/logback-site/src/site/pages/manual/layouts.html logback/trunk/logback-site/src/site/pages/news.html Log: Added documentation and news about XMLLayout. This fixes LBCLASSIC-22 Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java ============================================================================== --- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java (original) +++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java Thu Feb 5 22:25:21 2009 @@ -75,7 +75,7 @@ * @param str * The String that is inserted into an existing CDATA Section. */ - public static void appendEscapingCDATA(StringBuffer output, String str) { + public static void appendEscapingCDATA(StringBuilder output, String str) { if (str == null) { return; } Modified: logback/trunk/logback-site/src/site/pages/faq.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/faq.html (original) +++ logback/trunk/logback-site/src/site/pages/faq.html Thu Feb 5 22:25:21 2009 @@ -117,7 +117,7 @@ </dt> <dd> <p>This question is answered in the <a - href="manual/joran.html#auto_configuration">relevant + href="manual/configuration.html#auto_configuration">relevant section</a> of the logback manual. </p> <hr/> @@ -181,7 +181,7 @@ </dt> <dd> <p>Yes, it is. Using <a - href="manual/joran.html#variableSubstitution">variable + href="manual/configuration.html#variableSubstitution">variable substitution</a>, it is possible to have a single configuration file to output logs to different destinations depending on each JEE application. Here is a sample @@ -251,9 +251,9 @@ <p>Making use of <a - href="manual/joran.html#variableSubstitution">variable + href="manual/configuration.html#variableSubstitution">variable substitution</a> as well as <a - href="manual/joran.html#defaultValuesForVariables">default + href="manual/configuration.html#defaultValuesForVariables">default values for variables</a>, if the <span class="variable">root-level</span> system property is set to <code>OFF</code>, then all logging will be turned Modified: logback/trunk/logback-site/src/site/pages/manual/appenders.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/manual/appenders.html (original) +++ logback/trunk/logback-site/src/site/pages/manual/appenders.html Thu Feb 5 22:25:21 2009 @@ -2860,9 +2860,10 @@ Then, we simply declare the given element. The action class will be called and our connection source will be bound to a JNDI context. </p> + <p> This is a very powerfull possibility of Joran. If you'd like to read more about Joran, please - visit our <a href="../joran.html">introduction to Joran</a>. + see the <a href="onJoran.html">chapter to Joran</a>. </p> --> @@ -3199,7 +3200,7 @@ differentiation, within the nested appender (FileAppender above), the key passed to the discriminator, "userid" in the above example, becomes a <a - href="joran.html#variableSubstitution">variable</a>. Consequently, + href="configuration.html#variableSubstitution">variable</a>. Consequently, this variable can be used to differentiate the actual resource used by a given nested appender. </p> 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 Feb 5 22:25:21 2009 @@ -254,9 +254,9 @@ needed to enable the configuration of an option. Note that the <code>PrintThreadName</code> option is boolean and not <code>String</code>. Configuration of logback components was - covered in detail in <a href="joran.html">"Chapter 3: Logback - configuration with Joran"</a>. Here is the configuration file - tailor-made for use with <code>MySampleLayout2</code>. + covered in detail in <a href="configuration.html">"Chapter 3: + Logback configuration"</a>. Here is the configuration + file tailor-made for use with <code>MySampleLayout2</code>. </p> @@ -1171,7 +1171,7 @@ Example 5.2: Sample usage of EventEvaluators (logback-examples/src/main/java/chapter5/callerEvaluatorConfig.xml) </em> - <div class="source"><pre><configuration> + <p class="source"><configuration> <b><evaluator name="DISP_CALLER_EVAL"> <Expression>logger.getName().contains("chapter5") && \ message.contains("who calls thee")</Expression> @@ -1187,7 +1187,7 @@ <root level="debug"> <appender-ref ref="STDOUT" /> </root> -</configuration></pre></div> +</configuration></p> <p>Due to XML encoding rules, the & character cannot be written as is, and needs to be escaped as &.</p> @@ -1201,7 +1201,7 @@ (logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java)</a> </em> </p> - <div class="source"><pre>package chapter5; + <p class="source">package chapter5; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1233,7 +1233,7 @@ } } } -}</pre></div> +}</p> <p> The <em>CallerEvaluatorExample</em> application does nothing particularly fancy. Five logging requests are issued, the third one being @@ -1466,8 +1466,8 @@ <p>should yield:</p> -<div class="source">0 [main] DEBUG - Everything's going well -3 [main] <span class="red">ERROR</span> - maybe not quite... </div> + <p class="source">0 [main] DEBUG - Everything's going well +3 [main] <span class="red">ERROR</span> - maybe not quite... </p> <p>Please note that the string "ERROR" is highlighted in red, @@ -1482,15 +1482,13 @@ - <h2> - <a name="ClassicHTMLLayout" href="#ClassicHTMLLayout">Generating logs in HTML format</a> - </h2> + <h3> + <a name="ClassicHTMLLayout" href="#ClassicHTMLLayout">HTMLLayout</a> + </h3> - <p>Logback provides a special <a - href="../xref/ch/qos/logback/core/Layout.html"><code>Layout</code></a>, - namely <a - href="../xref/ch/qos/logback/classic/html/HTMLLayout.html"> - <code>HTMLLayout</code></a>, to generate logs directly in HTML + <p><a + href="../xref/ch/qos/logback/classic/html/HTMLLayout.html"><code>HTMLLayout</code></a> + (as included in logback-classic) generates logs in HTML format. <code>HTMLLayout</code> outputs logging events in an HTML table where each row of the table corresponds to a logging event.</p> @@ -1538,7 +1536,7 @@ <p>Launching the <code>TrivialMain</code> application listed below will create the file <em>test.html</em> on your local drive.</p> -<div class="source">import org.slf4j.Logger; + <p class="source">import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TrivialMain { @@ -1553,7 +1551,7 @@ } logger.error("Finish off with fireworks", new Exception("Just testing")); } -}</div> +}</p> <p>The contents of <em>test.html</em> should be similar to: </p> @@ -1636,7 +1634,7 @@ shown in the sample configuration below. </p> -<div class="source"><pre><configuration> + <p class="source"><configuration> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <ActiveFileName>lastLogEntries.html</ActiveFileName> @@ -1655,20 +1653,62 @@ <root level="debug"> <appender-ref ref="FILE" /> </root> -</configuration></pre></div> +</configuration></p> + + <h3><a name="log4jXMLLayout" href="#log4jXMLLayout">Log4j XMLLayout</a></h3> + + + <p><a + href="../xref/ch/qos/logback/classic/log4j/XMLLayout.html">XMLLayout</a> + (part of logback-classic) generates output in a log4j.dtd + compliant format. It can be used to inter-operate with tools such + as <a + href="http://logging.apache.org/chainsaw/index.html">Chainsaw</a> + and <a href="http://vigilog.sourceforge.net/">Vigilog</a> capable + of processing files generated by <a + href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/XMLLayout.html">log4j's + XMLLayout</a>. + </p> + + <p>As the original XMLLayout in log4j version 1.2.15, XMLLayout in + logback-classic admits two boolean properties, <span + class="option">LocationInfo</span> and <span + class="option">Properties</span>. Setting <span + class="option">LocationInfo</span> to true enables the inclusion + of location info (caller data) in the each event. Setting <span + class="option">Properties</span> to true enables the inclusion of + MDC information. Both options are set to false by default. + </p> + + <p>Here is a sample configuration</p> + + <p class="source"><configuration> + <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <File>test.xml</File> + <layout class="ch.qos.logback.classic.log4j.XMLLayout"> + <LocationInfo>true</LocationInfo> + </layout> + </appender> + + <root level="debug"> + <appender-ref ref="FILE" /> + </root> +</configuration> </p> + <h2>Logback access</h2> <p>Most logback-access layouts are mere adaptations of logback-classic layouts. Logback-classic and logback-access modules address different needs, but in general offer comparable - power and flexibility.</p> + functionality.</p> <h3>Writing your own Layout</h3> <p>Writing a custom <code>Layout</code> for logback access is nearly identical as its sibling<code>Layout</code> in logback-classic.</p> + <a name="AccessPatternLayout"></a> <h3>PatternLayout</h3> 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 Feb 5 22:25:21 2009 @@ -28,7 +28,8 @@ <hr width="80%" align="center" /> - <h3>TARGET DATE: 26th of January 2009 - Release of version 0.9.15</h3> + <h3>TARGET DATE: 6th of February 2009 - Release of version + 0.9.15</h3> <p>When the reset() method in <code>LoggerContext</code> is called, registered turbo filters are first stopped before being @@ -39,7 +40,7 @@ <p>Added a servlet for viewing internal status messages as an HTML table. Two separate implementations are available; one for <a - href="manual/joran.html#viewingStatusMessages">logback-classic</a> + href="manual/configuration.html#viewingStatusMessages">logback-classic</a> and the other for <a href="access.html#viewingStatusMessages">logback-access</a>.</p> @@ -56,6 +57,14 @@ related to loss of MDC information in deferred logging events. </p> + <p>Added <em>log4j.dtd</em> compatible <a + href="manual/layouts.html#log4jXMLLayout"><code>XMLLayout</code></a> + as requested in <a + href="http://jira.qos.ch/browse/LBCLASSIC-22">LBCLASSIC-22</a>. + </p> + + <p>New chapter <a href="manual/onJoran.html">on Joran</a>.</p> + <h3>29th of December 2008 - Release of version 0.9.14</h3> <p>Corrected a serious dead-lock problem occuring during @@ -252,9 +261,9 @@ </p> <p>Logback now supports <a - href="manual/joran.html#contextName">setting the logger context + href="manual/configuration.html#contextName">setting the logger context name</a> as well as inserting variables <a - href="manual/joran.html#insertFromJNDI">stored in JNDI</a> as + href="manual/configuration.html#insertFromJNDI">stored in JNDI</a> as properties. </p> @@ -633,8 +642,9 @@ logback's configuration framework. A file can contain an <em>include</em> element that has a <em>file</em> or <em>url</em> attribute pointing to a configuration file. See the <a - href="manual/joran.html#Include">chapter about configuration</a> - in the logback's online manual for more information. + href="manual/configuration.html#Include">chapter about + configuration</a> in the logback's online manual for more + information. </p> <p>Corrected bug 53 reported by Wilkins Poe. There is now a <a