Repository: logging-log4j2 Updated Branches: refs/heads/master a3a69b1af -> 09ad711dd
[LOG4J2-1578] RoutingAppender can be configured with scripts. Site documentation and changes.xml update. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/09ad711d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/09ad711d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/09ad711d Branch: refs/heads/master Commit: 09ad711dd5f5055665d4d95ffd4f78e4125b017f Parents: a3a69b1 Author: Gary Gregory <[email protected]> Authored: Wed Sep 14 19:11:59 2016 -0700 Committer: Gary Gregory <[email protected]> Committed: Wed Sep 14 19:11:59 2016 -0700 ---------------------------------------------------------------------- src/changes/changes.xml | 3 ++ src/site/xdoc/manual/appenders.xml | 69 ++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/09ad711d/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 5a4bf2f..eadd56a 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -138,6 +138,9 @@ <action issue="LOG4J2-1502" dev="ggregory" type="fix" due-to="Sumit Singhal"> Fixed issue where CsvParameterLayout and CsvLogEventLayout inserted NUL characters if data starts with {, (, [ or " </action> + <action issue="LOG4J2-1578" dev="ggregory" type="add"> + RoutingAppender can be configured with scripts. Add Script in a Routes element. + </action> <action issue="LOG4J2-1349" dev="rpopma" type="add"> (GC) Added support for garbage-free ThreadContext map. Disabled by default, users need to enable this explicitly. </action> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/09ad711d/src/site/xdoc/manual/appenders.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/manual/appenders.xml b/src/site/xdoc/manual/appenders.xml index aca7d5d..bd23ac5 100644 --- a/src/site/xdoc/manual/appenders.xml +++ b/src/site/xdoc/manual/appenders.xml @@ -3315,8 +3315,36 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { <tr> <td>Script</td> <td>Script</td> - <td>This Script runs when Log4j starts the RoutingAppender and returns a String Route key to determine - the default Route.</td> + <td> + <p> + This Script runs when Log4j starts the RoutingAppender and returns a String Route key to + determine the default Route. + </p> + <p> + This script is passed the following variables: + </p> + <table> + <caption align="top">RoutingAppender Script Parameters</caption> + <tr> + <th>Parameter Name</th> + <th>Type</th> + <th>Description</th> + </tr> + <tr> + <td>configuration</td> + <td>Configuration</td> + <td>The active Configuration.</td> + </tr> + <tr> + <td>staticVariables</td> + <td>Map</td> + <td> + A Map shared between all script invocations for this appender instance. This is + the same map passed to the Routes Script. + </td> + </tr> + </table> + </td> </tr> <tr> <td>ignoreExceptions</td> @@ -3377,10 +3405,39 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { Appender definition then an Appender will be created within the context of the RoutingAppender and will be reused each time a matching Appender name is referenced through a Route. </p> - <p> - In this example, the script runs for each log event and picks a route based on the presence of a - Marker named "AUDIT". - </p> + <p> + This script is passed the following variables: + </p> + <table> + <caption align="top">RoutingAppender Routes Script Parameters</caption> + <tr> + <th>Parameter Name</th> + <th>Type</th> + <th>Description</th> + </tr> + <tr> + <td>configuration</td> + <td>Configuration</td> + <td>The active Configuration.</td> + </tr> + <tr> + <td>staticVariables</td> + <td>Map</td> + <td> + A Map shared between all script invocations for this appender instance. This is + the same map passed to the Routes Script. + </td> + </tr> + <tr> + <td>logEvent</td> + <td>LogEvent</td> + <td>The log event.</td> + </tr> + </table> + <p> + In this example, the script runs for each log event and picks a route based on the presence of a + Marker named "AUDIT". + </p> <pre class="prettyprint linenums"><