Repository: logging-log4j2 Updated Branches: refs/heads/master 0a9e99f93 -> 220aeb7ef
[LOG4J2-1379] Add documentation on YAML format Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/220aeb7e Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/220aeb7e Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/220aeb7e Branch: refs/heads/master Commit: 220aeb7ef45de5b73a1b4511e9425e407ad73683 Parents: 0a9e99f Author: Matt Sicker <[email protected]> Authored: Wed Nov 16 14:24:29 2016 -0600 Committer: Matt Sicker <[email protected]> Committed: Wed Nov 16 14:24:29 2016 -0600 ---------------------------------------------------------------------- src/changes/changes.xml | 3 ++ src/site/site.xml | 1 + src/site/xdoc/manual/configuration.xml.vm | 66 ++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/220aeb7e/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 10ee145..b9e12e3 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -129,6 +129,9 @@ <action issue="LOG4J2-1700" dev="ggregory" type="update"> Update Jansi from 1.13 to 1.14. </action> + <action issue="LOG4J2-1379" dev="mattsicker" type="add"> + Add documentation regarding YAML configuration format. + </action> <action issue="LOG4J2-1681" dev="rpopma" type="add"> Changed visibility of indexed getter methods in SortedArrayStringMap from package-protected to public. </action> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/220aeb7e/src/site/site.xml ---------------------------------------------------------------------- diff --git a/src/site/site.xml b/src/site/site.xml index 3c63ef2..b69d3a1 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -81,6 +81,7 @@ <item name="Configuration Syntax" href="/manual/configuration.html#ConfigurationSyntax" /> <item name="XML Syntax" href="/manual/configuration.html#XML"/> <item name="JSON Syntax" href="/manual/configuration.html#JSON"/> + <item name="YAML Syntax" href="/manual/configuration.html#YAML"/> <item name="Properties Syntax" href="/manual/configuration.html#Properties"/> <item name="Configuring Loggers" href="/manual/configuration.html#Loggers"/> <item name="Configuring Appenders" href="/manual/configuration.html#Appenders"/> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/220aeb7e/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 2117dd2..05522c1 100644 --- a/src/site/xdoc/manual/configuration.xml.vm +++ b/src/site/xdoc/manual/configuration.xml.vm @@ -695,6 +695,72 @@ public class Bar { <version>${jackson2Version}</version> </dependency> ]]></pre> + <a name="YAML"/> + <h4>Configuration with YAML</h4> + <p> + Log4j also supports using YAML for configuration files. The structure follows the same pattern as both the + XML and YAML configuration formats. For example: + </p> + <pre class="prettyprint linenums"><![CDATA[ +Configuration: + status: warn + name: YAMLConfigTest + properties: + property: + name: filename + value: target/test-yaml.log + thresholdFilter: + level: debug + appenders: + Console: + name: STDOUT + PatternLayout: + Pattern: "%m%n" + File: + name: File + fileName: ${dollar}{filename} + bufferedIO: false + PatternLayout: + Pattern: "%d %p %C{1.} [%t] %m%n" + List: + name: List + Filters: + ThresholdFilter: + level: error + + Loggers: + logger: + - + name: org.apache.logging.log4j.test1 + level: debug + additivity: false + ThreadContextMapFilter: + KeyValuePair: + key: test + value: 123 + AppenderRef: + ref: STDOUT + - + name: org.apache.logging.log4j.test2 + level: debug + additivity: false + AppenderRef: + ref: File + Root: + level: error + AppenderRef: + ref: STDOUT + ]]></pre> + <p> + In order to use YAML configuration files, the Jackson YAML data format must be included: + </p> + <pre class="prettyprint linenums"><![CDATA[ +<dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + <version>${jackson2Version}</version> +</dependency> + ]]></pre> <a name="Loggers"/> <h4>Configuring loggers</h4> <p>
