Repository: logging-log4j2 Updated Branches: refs/heads/master 8e79b7b09 -> f9ac016be
LOG4J2-816 Added section on XInclude to user manual Configuration page. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/f9ac016b Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f9ac016b Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f9ac016b Branch: refs/heads/master Commit: f9ac016beccda9499c3f76d131743ba4e54acf3a Parents: 8e79b7b Author: rpopma <[email protected]> Authored: Sun Sep 21 01:36:24 2014 +0900 Committer: rpopma <[email protected]> Committed: Sun Sep 21 01:36:24 2014 +0900 ---------------------------------------------------------------------- src/changes/changes.xml | 3 ++ src/site/site.xml | 1 + src/site/xdoc/manual/configuration.xml.vm | 47 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f9ac016b/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 0e48818..5c150bc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -24,6 +24,9 @@ </properties> <body> <release version="2.1" date="2014-??-??" description="Bug fixes and enhancements"> + <action issue="LOG4J2-816" dev="rpopma" type="fix"> + Added section on XInclude to user manual Configuration page. + </action> <action issue="LOG4J2-678" dev="rpopma" type="fix" due-to="Matt Sicker"> Fixed minor issues with Log4j2 web site/documentation. </action> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f9ac016b/src/site/site.xml ---------------------------------------------------------------------- diff --git a/src/site/site.xml b/src/site/site.xml index 3e0ac03..3a439ea 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -69,6 +69,7 @@ <item name="Configuring Appenders" href="/manual/configuration.html#Appenders"/> <item name="Configuring Filters" href="/manual/configuration.html#Filters"/> <item name="Property Substitution" href="/manual/configuration.html#PropertySubstitution"/> + <item name="XInclude" href="/manual/configuration.html#XInclude"/> <item name="Status Messages" href="/manual/configuration.html#StatusMessages"/> <item name="Unit Testing in Maven" href="/manual/configuration.html#UnitTestingInMaven"/> <item name="System Properties" href="/manual/configuration.html#SystemProperties"/> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f9ac016b/src/site/xdoc/manual/configuration.xml.vm ---------------------------------------------------------------------- diff --git a/src/site/xdoc/manual/configuration.xml.vm b/src/site/xdoc/manual/configuration.xml.vm index 720b2df..7c006e2 100644 --- a/src/site/xdoc/manual/configuration.xml.vm +++ b/src/site/xdoc/manual/configuration.xml.vm @@ -931,6 +931,53 @@ public class Bar { See <a href="appenders.html#RoutingAppender">RoutingAppender</a> for more information.</i> </p> </subsection> + <a name="XInclude"/> + <subsection name="XInclude"> + <p> + XML configuration files can include other files with <a href="http://www.xml.com/lpt/a/1009">XInclude</a>. + Here is an example log4j2.xml file that includes two other files: + </p> + <pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> +<configuration xmlns:xi="http://www.w3.org/2001/XInclude" + status="warn" name="XIncludeDemo"> + <properties> + <property name="filename">xinclude-demo.log</property> + </properties> + <ThresholdFilter level="debug"/> + <xi:include href="log4j-xinclude-appenders.xml" /> + <xi:include href="log4j-xinclude-loggers.xml" /> +</configuration>]]></pre> + <p>log4j-xinclude-appenders.xml:</p> + <pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> +<appenders> + <Console name="STDOUT"> + <PatternLayout pattern="%m%n" /> + </Console> + <File name="File" fileName="${filename}" bufferedIO="true" immediateFlush="true"> + <PatternLayout> + <pattern>%d %p %C{1.} [%t] %m%n</pattern> + </PatternLayout> + </File> +</appenders>]]></pre> + <p>log4j-xinclude-loggers.xml:</p> + <pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> +<loggers> + <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false"> + <ThreadContextMapFilter> + <KeyValuePair key="test" value="123" /> + </ThreadContextMapFilter> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false"> + <appender-ref ref="File" /> + </logger> + + <root level="error"> + <appender-ref ref="STDOUT" /> + </root> +</loggers>]]></pre> + </subsection> <a name="StatusMessages"/> <subsection name="Status Messages"> <p>
