Repository: logging-log4j2 Updated Branches: refs/heads/master 935cc1997 -> 904e58b26
[LOG4J2-2197] Document default property value support. Applying patch with small changes for grammar. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/904e58b2 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/904e58b2 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/904e58b2 Branch: refs/heads/master Commit: 904e58b266a673de2103000d8b7f021155661d65 Parents: 935cc19 Author: Gary Gregory <[email protected]> Authored: Wed Jan 17 13:41:48 2018 -0700 Committer: Gary Gregory <[email protected]> Committed: Wed Jan 17 13:41:48 2018 -0700 ---------------------------------------------------------------------- src/changes/changes.xml | 3 +++ src/site/xdoc/manual/configuration.xml.vm | 4 ++-- src/site/xdoc/manual/lookups.xml | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/904e58b2/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1126598..868579f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -95,6 +95,9 @@ <action issue="LOG4J2-2185" dev="ggregory" type="add"> Add a simple JDBC DriverManager-based ConnectionSource that uses JDBC's DriverManager#getConnection(String, String, String). </action> + <action issue="LOG4J2-2197" dev="ggregory" type="update" due-to="Fabrice Daugan"> + Document default property value support. + </action> </release> <release version="2.10.0" date="2017-11-18" description="GA Release 2.10.0"> <action issue="LOG4J2-2120" dev="mikes" type="add" due-to="Carter Douglas Kozak "> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/904e58b2/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 02b3467..77c5f82 100644 --- a/src/site/xdoc/manual/configuration.xml.vm +++ b/src/site/xdoc/manual/configuration.xml.vm @@ -1018,7 +1018,7 @@ rootLogger.appenderRef.stdout.ref = STDOUT </tr> <tr> <td>env</td> - <td>System environment variables</td> + <td>System environment variables. The formats are <code>${dollar}{env:ENV_NAME}</code> and <code>${dollar}{env:ENV_NAME:-default_value}</code>.</td> </tr> <tr> <td>jndi</td> @@ -1053,7 +1053,7 @@ rootLogger.appenderRef.stdout.ref = STDOUT </tr> <tr> <td>sys</td> - <td>System properties</td> + <td>System properties. The formats are <code>${dollar}{sys:some.property}</code> and <code>${dollar}{sys:some.property:-default_value}</code>.</td> </tr> </table> <p> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/904e58b2/src/site/xdoc/manual/lookups.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/manual/lookups.xml b/src/site/xdoc/manual/lookups.xml index f244605..255054a 100644 --- a/src/site/xdoc/manual/lookups.xml +++ b/src/site/xdoc/manual/lookups.xml @@ -81,6 +81,16 @@ <pattern>%d %p %c{1.} [%t] $${env:USER} %m%n</pattern> </PatternLayout> </File>]]></pre> + <p> + This lookup also supports default value syntax. In the sample below, when the <code>USER</code> environment + variable is undefined, the default value <code>jdoe</code> is used: + </p> + <pre class="prettyprint linenums"><![CDATA[ +<File name="Application" fileName="application.log"> + <PatternLayout> + <pattern>%d %p %c{1.} [%t] $${env:USER:-jdoe} %m%n</pattern> + </PatternLayout> +</File>]]></pre> </subsection> <a name="JavaLookup"/> <subsection name="Java Lookup"> @@ -421,6 +431,14 @@ logger.info(PERFORMANCE, "Message in Performance.log");]]></pre> <Appenders> <File name="ApplicationLog" fileName="${sys:logPath}/app.log"/> </Appenders>]]></pre> + <p> + This lookup also supports default value syntax. In the sample below, when the <code>logPath</code> system + property is undefined, the default value <code>/var/logs</code> is used: + </p> + <pre class="prettyprint linenums"><![CDATA[ +<Appenders> + <File name="ApplicationLog" fileName="${sys:logPath:-/var/logs}/app.log"/> +</Appenders>]]></pre> </subsection> <a name="WebLookup"/> <subsection name="Web Lookup">
