Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1597 ae159dcf8 -> cd570f830


[LOG4J2-1597] site docs.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/cd570f83
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/cd570f83
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/cd570f83

Branch: refs/heads/LOG4J2-1597
Commit: cd570f830cecdee1df86a44494a831c5207b739a
Parents: ae159dc
Author: Gary Gregory <ggreg...@apache.org>
Authored: Mon Sep 19 00:47:35 2016 -0700
Committer: Gary Gregory <ggreg...@apache.org>
Committed: Mon Sep 19 00:47:35 2016 -0700

----------------------------------------------------------------------
 src/site/site.xml                  |  1 +
 src/site/xdoc/manual/appenders.xml | 34 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cd570f83/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index 9db99eb..a4da321 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -137,6 +137,7 @@
         <item name="Rolling Random Access File" 
href="/manual/appenders.html#RollingRandomAccessFileAppender"/>
         <item name="Routing" href="/manual/appenders.html#RoutingAppender"/>
         <item name="SMTP" href="/manual/appenders.html#SMTPAppender"/>
+        <item name="ScriptSelector" 
href="/manual/appenders.html#ScriptSelector"/>
         <item name="Socket" href="/manual/appenders.html#SocketAppender"/>
         <item name="Syslog" href="/manual/appenders.html#SyslogAppender"/>
         <item name="ZeroMQ/JeroMQ" 
href="/manual/appenders.html#JeroMQAppender"/>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cd570f83/src/site/xdoc/manual/appenders.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/appenders.xml 
b/src/site/xdoc/manual/appenders.xml
index b82b716..5196f2e 100644
--- a/src/site/xdoc/manual/appenders.xml
+++ b/src/site/xdoc/manual/appenders.xml
@@ -3657,6 +3657,40 @@ public class JpaLogEntity extends 
AbstractLogEventWrapperEntity {
   </Loggers>
 </Configuration>]]></pre>
         </subsection>
+        <a name="ScriptSelector"/>
+        <subsection name="ScriptSelector">
+          <p>
+            When the configuration is built, the <code>ScriptSelector</code> 
appender calls a <code>Script</code> 
+            to compute an appender name. Log4j then creates one of the 
appender named listed under 
+            <code>AppenderSet</code> using the name of the 
<code>ScriptSelector</code>. After configuration, Log4j 
+            ignores the <code>ScriptSelector</code>. Log4j only builds the one 
selected appender from the 
+            configuration tree, and ignores other <code>AppenderSet</code> 
child nodes. 
+          </p>
+          <p>
+            In the following example, the script returns the name "List2". The 
appender name is recorded under 
+            the name of the <code>ScriptSelector</code>, not the name of the 
selected appender, in this example, 
+            "SelectIt".
+          </p>
+<pre class="prettyprint linenums"><![CDATA[<Configuration status="WARN" 
name="RoutingTest">
+  <Appenders>
+    <ScriptSelector name="SelectIt">
+      <Script language="JavaScript"><![CDATA[
+        importPackage(java.lang);
+        System.getProperty("os.name").search("Windows") ? "List2" : 
"List1";]]]]><![CDATA[>
+      </Script>
+      <AppenderSet>
+        <List name="List1" />
+        <List name="List2" />
+      </AppenderSet>
+    </ScriptSelector>
+  </Appenders>
+  <Loggers>
+    <Root level="error">
+      <AppenderRef ref="SelectIt" />
+    </Root>
+  </Loggers>
+</Configuration>]]></pre>          
+        </subsection>
         <a name="SocketAppender"/>
         <subsection name="SocketAppender">
           <p>

Reply via email to