"Fossies" - the Fresh Open Source Software Archive

Member "apache-log4j-2.12.4-src/src/site/xdoc/manual/configuration.xml.vm" (28 Dec 2021, 121710 Bytes) of package /linux/misc/apache-log4j-2.12.4-src.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configuration.xml.vm": 2.12.3_vs_2.12.4.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 <?xml version="1.0"?>
    2 <!--
    3     Licensed to the Apache Software Foundation (ASF) under one or more
    4     contributor license agreements.  See the NOTICE file distributed with
    5     this work for additional information regarding copyright ownership.
    6     The ASF licenses this file to You under the Apache License, Version 2.0
    7     (the "License"); you may not use this file except in compliance with
    8     the License.  You may obtain a copy of the License at
    9 
   10          http://www.apache.org/licenses/LICENSE-2.0
   11 
   12     Unless required by applicable law or agreed to in writing, software
   13     distributed under the License is distributed on an "AS IS" BASIS,
   14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15     See the License for the specific language governing permissions and
   16     limitations under the License.
   17 -->
   18 
   19 #set($dollar = '$')
   20 
   21 <document xmlns="http://maven.apache.org/XDOC/2.0"
   22           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   23           xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
   24     <properties>
   25         <title>Configuring Log4j 2</title>
   26         <author email="rgoers@apache.org">Ralph Goers</author>
   27     </properties>
   28 
   29     <body>
   30       <section name="Configuration">
   31         #if (!$alignedFileName)
   32             #set ($isPDF = true)
   33         #else
   34             #set ($isPDF = false)
   35         #end
   36         <p>Inserting log requests into the application code requires a fair
   37           amount of planning and effort. Observation shows that approximately 4
   38           percent of code is dedicated to logging. Consequently, even moderately
   39           sized applications will have thousands of logging statements embedded
   40           within their code.  Given their number, it becomes imperative to
   41           manage these log statements without the need to modify them manually.
   42         </p>
   43         <p>
   44           Configuration of Log4j 2 can be accomplished in 1 of 4 ways:
   45         </p>
   46           <ol>
   47             <li>Through a configuration file written in XML, JSON, YAML, or properties format.</li>
   48             <li>Programmatically, by creating a ConfigurationFactory and Configuration implementation.</li>
   49             <li>Programmatically, by calling the APIs exposed in the Configuration interface to add
   50               components to the default configuration.</li>
   51             <li>Programmatically, by calling methods on the internal Logger class.</li>
   52           </ol>
   53         <p>
   54           This page focuses primarily on configuring Log4j through a configuration file. Information on
   55           programmatically configuring Log4j can be found at <a href="./extending.html">Extending Log4j 2</a>
   56           and <a href="customconfig.html">Programmatic Log4j Configuration</a>.
   57         </p>
   58         <p>
   59           Note that unlike Log4j 1.x, the public Log4j 2 API does not expose methods to add, modify or remove
   60           appenders and filters or manipulate the configuration in any way.
   61         </p>
   62         <a name="AutomaticConfiguration"/>
   63         <subsection name="Automatic Configuration">
   64           <p>
   65             Log4j has the ability to automatically configure itself during initialization.
   66             When Log4j starts it will locate all the ConfigurationFactory plugins and arrange them in weighted
   67             order from highest to lowest. As delivered, Log4j contains four ConfigurationFactory implementations:
   68             one for JSON, one for YAML, one for properties, and one for XML.
   69           </p>
   70             <ol>
   71               <li>Log4j will inspect the <code>"log4j.configurationFile"</code> system property and, if set,  will attempt to
   72                 load the configuration using the <code>ConfigurationFactory</code> that matches the file
   73                 extension.</li>
   74               <li>If no system property is set the properties ConfigurationFactory will look for
   75                 <code>log4j2-test.properties</code> in the classpath.</li>
   76               <li>If no such file is found the YAML ConfigurationFactory will look for
   77                 <code>log4j2-test.yaml</code> or <code>log4j2-test.yml</code> in the classpath.</li>
   78               <li>If no such file is found the JSON ConfigurationFactory will look for
   79                 <code>log4j2-test.json</code> or <code>log4j2-test.jsn</code> in the classpath.</li>
   80               <li>If no such file is found the XML ConfigurationFactory will look for
   81                 <code>log4j2-test.xml</code> in the classpath.</li>
   82               <li>If a test file cannot be located the properties ConfigurationFactory will look for
   83                 <code>log4j2.properties</code> on the classpath.</li>
   84               <li>If a properties file cannot be located the YAML ConfigurationFactory will look for
   85                 <code>log4j2.yaml</code> or <code>log4j2.yml</code> on the classpath.</li>
   86               <li>If a YAML file cannot be located the JSON ConfigurationFactory will look for
   87                 <code>log4j2.json</code> or <code>log4j2.jsn</code> on the classpath.</li>
   88               <li>If a JSON file cannot be located the XML ConfigurationFactory will try to locate
   89                 <code>log4j2.xml</code> on the classpath.</li>
   90               <li>If no configuration file could be located the <code>DefaultConfiguration</code> will
   91                 be used. This will cause logging output to go to the console.</li>
   92             </ol>
   93           <p>An example application named <code>MyApp</code> that uses log4j can be used to illustrate how
   94             this is done.
   95           </p>
   96 <pre class="prettyprint linenums"><![CDATA[
   97 import com.foo.Bar;
   98 
   99 // Import log4j classes.
  100 import org.apache.logging.log4j.Logger;
  101 import org.apache.logging.log4j.LogManager;
  102 
  103 public class MyApp {
  104 
  105     // Define a static logger variable so that it references the
  106     // Logger instance named "MyApp".
  107     private static final Logger logger = LogManager.getLogger(MyApp.class);
  108 
  109     public static void main(final String... args) {
  110 
  111         // Set up a simple configuration that logs on the console.
  112 
  113         logger.trace("Entering application.");
  114         Bar bar = new Bar();
  115         if (!bar.doIt()) {
  116             logger.error("Didn't do it.");
  117         }
  118         logger.trace("Exiting application.");
  119     }
  120 }
  121 ]]></pre>
  122           <p>
  123             <code>MyApp</code> begins by importing log4j related classes. It
  124             then defines a static logger variable with the name <code>MyApp</code>
  125             which happens to be the fully qualified name of the class.
  126           </p>
  127           <p>
  128             <code>MyApp</code> uses the <code>Bar</code> class defined in the package<code>com.foo</code>.
  129           </p>
  130 <pre class="prettyprint linenums"><![CDATA[
  131 package com.foo;
  132 import org.apache.logging.log4j.Logger;
  133 import org.apache.logging.log4j.LogManager;
  134 
  135 public class Bar {
  136   static final Logger logger = LogManager.getLogger(Bar.class.getName());
  137 
  138   public boolean doIt() {
  139     logger.entry();
  140     logger.error("Did it again!");
  141     return logger.exit(false);
  142   }
  143 }
  144 ]]></pre>
  145           <p>
  146             Log4j will provide a default configuration if it cannot locate a configuration file. The default
  147             configuration, provided in the DefaultConfiguration class, will set up:
  148           </p>
  149             <ul>
  150               <li>A <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/appender/ConsoleAppender.html">ConsoleAppender</a>
  151                 attached to the root logger.</li>
  152               <li>A <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/layout/PatternLayout.html">PatternLayout</a>
  153                 set to the pattern "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" attached to the ConsoleAppender</li>
  154             </ul>
  155           <p>
  156             Note that by default Log4j assigns the root logger to <code>Level.ERROR</code>.
  157           </p>
  158           <p>The output of MyApp would be similar to:
  159           </p>
  160 <pre><![CDATA[
  161 17:13:01.540 [main] ERROR com.foo.Bar - Did it again!
  162 17:13:01.540 [main] ERROR MyApp - Didn't do it.
  163 ]]></pre>
  164           <p>
  165             As was described previously, Log4j will first attempt to configure itself from configuration files. A
  166             configuration equivalent to the default would look like:
  167           </p>
  168           <pre class="prettyprint linenums"><![CDATA[
  169 <?xml version="1.0" encoding="UTF-8"?>
  170 <Configuration status="WARN">
  171   <Appenders>
  172     <Console name="Console" target="SYSTEM_OUT">
  173       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
  174     </Console>
  175   </Appenders>
  176   <Loggers>
  177     <Root level="error">
  178       <AppenderRef ref="Console"/>
  179     </Root>
  180   </Loggers>
  181 </Configuration>
  182 ]]></pre>
  183           <p>
  184             Once the file above is placed into the classpath as log4j2.xml you will get results identical to
  185             those listed above. Changing the root level to trace will result in results similar to:
  186           </p>
  187           <pre><![CDATA[
  188 17:13:01.540 [main] TRACE MyApp - Entering application.
  189 17:13:01.540 [main] TRACE com.foo.Bar - entry
  190 17:13:01.540 [main] ERROR com.foo.Bar - Did it again!
  191 17:13:01.540 [main] TRACE com.foo.Bar - exit with (false)
  192 17:13:01.540 [main] ERROR MyApp - Didn't do it.
  193 17:13:01.540 [main] TRACE MyApp - Exiting application.
  194 ]]></pre>
  195           <p>
  196             Note that status logging is disabled when the default configuration is used.
  197           </p>
  198         </subsection>
  199         <a name="Additivity"/>
  200         <subsection name="Additivity">
  201           <p>
  202             Perhaps it is desired to eliminate all the TRACE output from everything except <code>com.foo.Bar</code>.
  203             Simply changing the log level would not accomplish the task. Instead, the solution is to
  204             add a new logger definition to the configuration:
  205           </p>
  206             <pre class="prettyprint linenums"><![CDATA[
  207 <Logger name="com.foo.Bar" level="TRACE"/>
  208 <Root level="ERROR">
  209   <AppenderRef ref="STDOUT">
  210 </Root>
  211 ]]></pre>
  212           <p>
  213             With this configuration all log events from <code>com.foo.Bar</code> will be recorded while only error
  214             events will be recorded from all other components.
  215           </p>
  216           <p>
  217             In the previous example all the events from <code>com.foo.Bar</code> were still written to the Console. This is
  218             because the logger for <code>com.foo.Bar</code> did not have any appenders configured while its parent did. In fact,
  219             the following configuration
  220           </p>
  221           <pre class="prettyprint linenums"><![CDATA[
  222 <?xml version="1.0" encoding="UTF-8"?>
  223 <Configuration status="WARN">
  224   <Appenders>
  225     <Console name="Console" target="SYSTEM_OUT">
  226       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
  227     </Console>
  228   </Appenders>
  229   <Loggers>
  230     <Logger name="com.foo.Bar" level="trace">
  231       <AppenderRef ref="Console"/>
  232     </Logger>
  233     <Root level="error">
  234       <AppenderRef ref="Console"/>
  235     </Root>
  236   </Loggers>
  237 </Configuration>
  238 ]]></pre>
  239           <p>would result in</p>
  240           <pre><![CDATA[
  241 17:13:01.540 [main] TRACE com.foo.Bar - entry
  242 17:13:01.540 [main] TRACE com.foo.Bar - entry
  243 17:13:01.540 [main] ERROR com.foo.Bar - Did it again!
  244 17:13:01.540 [main] TRACE com.foo.Bar - exit (false)
  245 17:13:01.540 [main] TRACE com.foo.Bar - exit (false)
  246 17:13:01.540 [main] ERROR MyApp - Didn't do it.
  247 ]]></pre>
  248           <p>Notice that the trace messages from <code>com.foo.Bar</code> appear twice. This is because the appender associated
  249             with logger <code>com.foo.Bar</code> is first used, which writes the first instance to the Console. Next, the parent
  250             of <code>com.foo.Bar</code>, which in this case is the root logger, is referenced. The event is then passed to its
  251             appender, which is also writes to the Console, resulting in the second instance. This is known as
  252             additivity. While additivity can be quite a convenient feature (as in the first previous example where
  253             no appender reference needed to be configured), in many cases this behavior is considered undesirable
  254             and so it is possible to disable it by setting the additivity attribute on the logger to false:
  255           </p>
  256           <pre class="prettyprint linenums"><![CDATA[
  257 <?xml version="1.0" encoding="UTF-8"?>
  258 <Configuration status="WARN">
  259   <Appenders>
  260     <Console name="Console" target="SYSTEM_OUT">
  261       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
  262     </Console>
  263   </Appenders>
  264   <Loggers>
  265     <Logger name="com.foo.Bar" level="trace" additivity="false">
  266       <AppenderRef ref="Console"/>
  267     </Logger>
  268     <Root level="error">
  269       <AppenderRef ref="Console"/>
  270     </Root>
  271   </Loggers>
  272 </Configuration>
  273 ]]></pre>
  274           <p>
  275             Once an event reaches a logger with its additivity set to false the event will not be passed to
  276             any of its parent loggers, regardless of their additivity setting.
  277           </p>
  278         </subsection>
  279         <a name="AutomaticReconfiguration"/>
  280         <subsection name="Automatic Reconfiguration">
  281           <p>
  282             When configured from a File, Log4j has the ability to automatically detect changes to the configuration
  283             file and reconfigure itself. If the <code>monitorInterval</code> attribute is specified on the configuration
  284             element and is set to a non-zero value then the file will be checked the next time a log event is evaluated
  285             and/or logged and the monitorInterval has elapsed since the last check. The example below shows how
  286             to configure the attribute so that the configuration file will be checked for changes only after at
  287             least 30 seconds have elapsed.  The minimum interval is 5 seconds.
  288           </p>
  289           <pre class="prettyprint linenums"><![CDATA[
  290 <?xml version="1.0" encoding="UTF-8"?>
  291 <Configuration monitorInterval="30">
  292 ...
  293 </Configuration>
  294 ]]></pre>
  295         </subsection>
  296         <a name="ChainsawSupport"/>
  297         <subsection name="Chainsaw can automatically process your log files (Advertising appender configurations)">
  298           <p>
  299             Log4j provides the ability to 'advertise' appender configuration details for all file-based appenders as well
  300             as socket-based appenders.  For example, for file-based appenders, the file location and the pattern layout in the file
  301             are included in the advertisement.  Chainsaw and other external systems can discover these advertisements and
  302             use that information to intelligently process the log file.
  303           </p>
  304           <p>
  305             The mechanism by which an advertisement is exposed, as well as the advertisement format, is specific to each
  306             Advertiser implementation.  An external system which would like to work with a specific Advertiser implementation
  307             must understand how to locate the advertised configuration as well as the format of the advertisement.  For example,
  308             a 'database' Advertiser may store configuration details in a database table.  An external system can read
  309             that database table in order to discover the file location and the file format.
  310           </p>
  311           <p>
  312             Log4j provides one Advertiser implementation, a 'multicastdns' Advertiser, which advertises appender configuration
  313             details via IP multicast using the <a href="http://jmdns.sourceforge.net">http://jmdns.sourceforge.net</a> library.
  314           </p>
  315           <p>
  316             Chainsaw automatically discovers log4j's multicastdns-generated advertisements and displays those discovered
  317             advertisements in Chainsaw's Zeroconf tab (if the jmdns library is in Chainsaw's classpath).  To begin parsing and tailing
  318             a log file provided in an advertisement, just double-click the advertised entry in Chainsaw's Zeroconf tab.
  319             Currently, Chainsaw only supports FileAppender advertisements.
  320           </p>
  321           <p>
  322             To advertise an appender configuration:
  323           </p>
  324             <ul>
  325               <li>Add the JmDns library from <a href="http://jmdns.sourceforge.net">http://jmdns.sourceforge.net</a> to the application classpath</li>
  326               <li>Set the 'advertiser' attribute of the configuration element to 'multicastdns'</li>
  327               <li>Set the 'advertise' attribute on the appender element to 'true'</li>
  328               <li>If advertising a FileAppender-based configuration, set the 'advertiseURI' attribute on the appender element to an appropriate URI</li>
  329             </ul>
  330           <p>
  331             FileAppender-based configurations require an additional 'advertiseURI' attribute to be specified on the appender.
  332             The 'advertiseURI' attribute provides Chainsaw with information on how the file can be accessed.
  333             For example, the file may be remotely accessible to Chainsaw via ssh/sftp by specifying a Commons VFS
  334             (<a href="http://commons.apache.org/proper/commons-vfs/">http://commons.apache.org/proper/commons-vfs/</a>) sftp:// URI,
  335             an http:// URI may be used if the file is accessible through a web server, or a file:// URI can be specified
  336             if accessing the file from a locally-running instance of Chainsaw.
  337           </p>
  338           <p>
  339             Here is an example advertisement-enabled appender configuration which can be used by a locally-running Chainsaw to
  340             automatically tail the log file (notice the file:// advertiseURI):
  341           </p>
  342           <p>
  343             <b>Please note, you must add the JmDns library from <a href="http://jmdns.sourceforge.net">http://jmdns.sourceforge.net</a>
  344             to your application classpath in order to advertise with the 'multicastdns' advertiser.</b>
  345           </p>
  346           <pre class="prettyprint linenums"><![CDATA[
  347 <?xml version="1.0" encoding="UTF-8"?>
  348 <Configuration advertiser="multicastdns">
  349 ...
  350 </Configuration>
  351 <Appenders>
  352   <File name="File1" fileName="output.log" bufferedIO="false" advertiseURI="file://path/to/output.log" advertise="true">
  353   ...
  354   </File>
  355 </Appenders>
  356 ]]></pre>
  357 </subsection>
  358         <a name="ConfigurationSyntax"/>
  359         <subsection name="Configuration Syntax">
  360           <p>
  361             As of version 2.9, for security reasons, Log4j does not process DTD in XML files.
  362             If you want to split the configuration in multiple files, use <a href="#XInclude">XInclude</a> or
  363             <a href="#CompositeConfiguration">Composite Configuration</a>.
  364           </p>
  365           <p>
  366             As the previous examples have shown as well as those to follow, Log4j allows you to easily
  367             redefine logging behavior without needing to modify your application. It is possible to
  368             disable logging for certain parts of the application, log only when specific criteria are met such
  369             as the action being performed for a specific user, route output to Flume or a log reporting system,
  370             etc. Being able to do this requires understanding the syntax of the configuration files.
  371           </p>
  372           <p>
  373             The configuration element in the XML file accepts several attributes:
  374           </p>
  375             <table>
  376               <tr>
  377                 <th>Attribute Name</th>
  378                 <th>Description</th>
  379               </tr>
  380               <tr>
  381                 <td>advertiser</td>
  382                 <td>(Optional) The Advertiser plugin name which will be used to advertise individual
  383                 FileAppender or SocketAppender configurations.  The only Advertiser plugin provided is 'multicastdns".</td>
  384               </tr>
  385               <tr>
  386                 <td>dest</td>
  387                 <td>Either "err" for stderr, "out" for stdout, a file path, or a URL.</td>
  388               </tr>
  389 
  390               <tr>
  391                 <td>monitorInterval</td>
  392                 <td>The minimum amount of time, in seconds, that must elapse before the file configuration
  393                   is checked for changes.</td>
  394               </tr>
  395               <tr>
  396                 <td>name</td>
  397                 <td>The name of the configuration.</td>
  398               </tr>
  399               <tr>
  400                 <td>packages</td>
  401                 <td>A comma separated list of package names to search for plugins. Plugins are only loaded
  402                   once per classloader so changing this value may not have any effect upon reconfiguration.</td>
  403               </tr>
  404               <tr>
  405                 <td>schema</td>
  406                 <td>Identifies the location for the classloader to located the XML Schema to use to validate
  407                   the configuration. Only valid when strict is set to true. If not set no schema validation
  408                   will take place.</td>
  409               </tr>
  410               <tr>
  411                  <td>shutdownHook</td>
  412                  <td>Specifies whether or not Log4j should automatically shutdown when the JVM shuts down. The
  413                  shutdown hook is enabled by default but may be disabled by setting this attribute to "disable"</td>
  414               </tr>
  415               <tr>
  416                  <td>shutdownTimeout</td>
  417                  <td>Specifies how many milliseconds appenders and background tasks will get to shutdown when the JVM shuts
  418                  down. Default is zero which mean that each appender uses its default timeout, and don't wait for background
  419                  tasks. Not all appenders will honor this, it is a hint and not an absolute guarantee that the shutdown
  420                  procedure will not take longer. Setting this too low increase the risk of losing outstanding log events
  421                  not yet written to the final destination. See <a class="javadoc"
  422                  href="../log4j-core/target/site/apidocs/org/apache/logging/log4j/core/LoggerContext.html${esc.hash}stop(long, java.util.concurrent.TimeUnit)">LoggerContext.stop(long,
  423                      java.util.concurrent.TimeUnit)</a>.
  424                   (Not used if <tt>shutdownHook</tt> is set to "disable".)</td>
  425               </tr>
  426               <tr>
  427                 <td>status</td>
  428                 <td><p>The level of internal Log4j events that should be logged to the console.
  429                 Valid values for this attribute are "trace", "debug", "info", "warn", "error" and "fatal".
  430                 Log4j will log details about initialization, rollover and other internal actions to the status logger.
  431                 Setting <tt>status="trace"</tt> is one of the first tools available to you if you need to
  432                 troubleshoot log4j.
  433                 </p><p>
  434                   (Alternatively, setting system property <tt>log4j2.debug</tt> will also print internal Log4j2 logging
  435                   to the console, including internal logging that took place before the configuration file was found.)
  436                 </p></td>
  437               </tr>
  438               <tr>
  439                 <td>strict</td>
  440                 <td>Enables the use of the strict XML format. Not supported in JSON configurations.</td>
  441               </tr>
  442               <tr>
  443                 <td>verbose</td>
  444                 <td>Enables diagnostic information while loading plugins.</td>
  445               </tr>
  446             </table>
  447           <a name="XML"/><h3>Configuration with XML</h3>
  448           <p>
  449             Log4j can be configured using two XML flavors; concise and strict. The concise format makes
  450             configuration very easy as the element names match the components they represent however it
  451             cannot be validated with an XML schema. For example, the ConsoleAppender is configured by
  452             declaring an XML element named Console under its parent appenders element. However, element
  453             and attribute names are are not case sensitive. In addition, attributes can either be specified
  454             as an XML attribute or as an XML element that has no attributes and has a text value. So
  455           </p>
  456           <pre class="prettyprint"><![CDATA[<PatternLayout pattern="%m%n"/>]]></pre>
  457           <p>and</p>
  458           <pre class="prettyprint"><![CDATA[
  459 <PatternLayout>
  460   <Pattern>%m%n</Pattern>
  461 </PatternLayout>]]></pre>
  462           <p>
  463             are equivalent.
  464           </p>
  465           <p>
  466             The file below represents the structure of an XML configuration, but note
  467             that the elements in italics below represent the concise element names that would appear in their place.
  468           </p>
  469 
  470           <pre class="prettyprint linenums"><![CDATA[
  471 <?xml version="1.0" encoding="UTF-8"?>;
  472 <Configuration>
  473   <Properties>
  474     <Property name="name1">value</property>
  475     <Property name="name2" value="value2"/>
  476   </Properties>
  477   <]]><i>filter</i>  ... <![CDATA[/>
  478   <Appenders>
  479     <]]><i>appender</i> ... <![CDATA[>
  480       <]]><i>filter</i>  ... <![CDATA[/>
  481     </]]><i>appender</i><![CDATA[>
  482     ...
  483   </Appenders>
  484   <Loggers>
  485     <Logger name="name1">
  486       <]]><i>filter</i>  ... <![CDATA[/>
  487     </Logger>
  488     ...
  489     <Root level="level">
  490       <AppenderRef ref="name"/>
  491     </Root>
  492   </Loggers>
  493 </Configuration>
  494 ]]></pre>
  495           <p>
  496             See the many examples on this page for sample appender, filter and logger declarations.
  497           </p>
  498             <h5>Strict XML</h5>
  499           <p>
  500             In addition to the concise XML format above, Log4j allows configurations to be specified in a
  501             more "normal" XML manner that can be validated using an XML Schema. This is accomplished by
  502             replacing the friendly element names above with their object type as shown below. For example,
  503             instead of the ConsoleAppender being configuerd using an element named Console it is instead
  504             configured as an appender element with a type attribute containing "Console".
  505           </p>
  506           <pre class="prettyprint linenums"><![CDATA[
  507 <?xml version="1.0" encoding="UTF-8"?>;
  508 <Configuration>
  509   <Properties>
  510     <Property name="name1">value</property>
  511     <Property name="name2" value="value2"/>
  512   </Properties>
  513   <Filter type="type" ... />
  514   <Appenders>
  515     <Appender type="type" name="name">
  516       <Filter type="type" ... />
  517     </Appender>
  518     ...
  519   </Appenders>
  520   <Loggers>
  521     <Logger name="name1">
  522       <Filter type="type" ... />
  523     </Logger>
  524     ...
  525     <Root level="level">
  526       <AppenderRef ref="name"/>
  527     </Root>
  528   </Loggers>
  529 </Configuration>
  530 ]]></pre>
  531           <p>
  532             Below is a sample configuration using the strict format.
  533           </p>
  534           <pre class="prettyprint linenums"><![CDATA[
  535 <?xml version="1.0" encoding="UTF-8"?>
  536 <Configuration status="debug" strict="true" name="XMLConfigTest"
  537                packages="org.apache.logging.log4j.test">
  538   <Properties>
  539     <Property name="filename">target/test.log</Property>
  540   </Properties>
  541   <Filter type="ThresholdFilter" level="trace"/>
  542 
  543   <Appenders>
  544     <Appender type="Console" name="STDOUT">
  545       <Layout type="PatternLayout" pattern="%m MDC%X%n"/>
  546       <Filters>
  547         <Filter type="MarkerFilter" marker="FLOW" onMatch="DENY" onMismatch="NEUTRAL"/>
  548         <Filter type="MarkerFilter" marker="EXCEPTION" onMatch="DENY" onMismatch="ACCEPT"/>
  549       </Filters>
  550     </Appender>
  551     <Appender type="Console" name="FLOW">
  552       <Layout type="PatternLayout" pattern="%C{1}.%M %m %ex%n"/><!-- class and line number -->
  553       <Filters>
  554         <Filter type="MarkerFilter" marker="FLOW" onMatch="ACCEPT" onMismatch="NEUTRAL"/>
  555         <Filter type="MarkerFilter" marker="EXCEPTION" onMatch="ACCEPT" onMismatch="DENY"/>
  556       </Filters>
  557     </Appender>
  558     <Appender type="File" name="File" fileName="${dollar}{filename}">
  559       <Layout type="PatternLayout">
  560         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
  561       </Layout>
  562     </Appender>
  563   </Appenders>
  564 
  565   <Loggers>
  566     <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
  567       <Filter type="ThreadContextMapFilter">
  568         <KeyValuePair key="test" value="123"/>
  569       </Filter>
  570       <AppenderRef ref="STDOUT"/>
  571     </Logger>
  572 
  573     <Logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
  574       <AppenderRef ref="File"/>
  575     </Logger>
  576 
  577     <Root level="trace">
  578       <AppenderRef ref="STDOUT"/>
  579     </Root>
  580   </Loggers>
  581 
  582 </Configuration>
  583 ]]></pre>
  584         <a name="JSON"/>
  585           <h4>Configuration with JSON</h4>
  586           <p>
  587             In addition to XML, Log4j can be configured using JSON. The JSON format is very similar to the
  588             concise XML format. Each key represents the name of a plugin and the key/value pairs associated
  589             with it are its attributes. Where a key contains more than a simple value it itself will be a
  590             subordinate plugin. In the example below, ThresholdFilter, Console, and PatternLayout are all
  591             plugins while the Console plugin will be assigned a value of STDOUT for its name attribute and the
  592             ThresholdFilter will be assigned a level of debug.
  593           </p>
  594           <pre class="prettyprint linenums"><![CDATA[
  595 { "configuration": { "status": "error", "name": "RoutingTest",
  596                      "packages": "org.apache.logging.log4j.test",
  597       "properties": {
  598         "property": { "name": "filename",
  599                       "value" : "target/rolling1/rollingtest-${dollar}${dollar}{sd:type}.log" }
  600       },
  601     "ThresholdFilter": { "level": "debug" },
  602     "appenders": {
  603       "Console": { "name": "STDOUT",
  604         "PatternLayout": { "pattern": "%m%n" },
  605         "ThresholdFilter": { "level": "debug" }
  606       },
  607       "Routing": { "name": "Routing",
  608         "Routes": { "pattern": "${dollar}${dollar}{sd:type}",
  609           "Route": [
  610             {
  611               "RollingFile": {
  612                 "name": "Rolling-${dollar}{sd:type}", "fileName": "${dollar}{filename}",
  613                 "filePattern": "target/rolling1/test1-${dollar}{sd:type}.%i.log.gz",
  614                 "PatternLayout": {"pattern": "%d %p %c{1.} [%t] %m%n"},
  615                 "SizeBasedTriggeringPolicy": { "size": "500" }
  616               }
  617             },
  618             { "AppenderRef": "STDOUT", "key": "Audit"}
  619           ]
  620         }
  621       }
  622     },
  623     "loggers": {
  624       "logger": { "name": "EventLogger", "level": "info", "additivity": "false",
  625                   "AppenderRef": { "ref": "Routing" }},
  626       "root": { "level": "error", "AppenderRef": { "ref": "STDOUT" }}
  627     }
  628   }
  629 }
  630 ]]></pre>
  631            <p>
  632             Note that in the RoutingAppender the Route element has been declared as an array. This is
  633             valid because each array element will be a Route component. This won't work for elements such as
  634             appenders and filters, where each element has a different name in the concise format. Appenders and
  635             filters can be defined as array elements if each appender or filter declares an attribute named "type"
  636             that contains the type of the appender. The following example illustrates this as well as how to
  637             declare multiple loggers as an array.
  638           </p>
  639            <pre class="prettyprint linenums"><![CDATA[
  640 { "configuration": { "status": "debug", "name": "RoutingTest",
  641                       "packages": "org.apache.logging.log4j.test",
  642       "properties": {
  643         "property": { "name": "filename",
  644                       "value" : "target/rolling1/rollingtest-${dollar}${dollar}{sd:type}.log" }
  645       },
  646     "ThresholdFilter": { "level": "debug" },
  647     "appenders": {
  648       "appender": [
  649          { "type": "Console", "name": "STDOUT", "PatternLayout": { "pattern": "%m%n" }, "ThresholdFilter": { "level": "debug" }},
  650          { "type": "Routing",  "name": "Routing",
  651           "Routes": { "pattern": "${dollar}${dollar}{sd:type}",
  652             "Route": [
  653               {
  654                 "RollingFile": {
  655                   "name": "Rolling-${dollar}{sd:type}", "fileName": "${dollar}{filename}",
  656                   "filePattern": "target/rolling1/test1-${dollar}{sd:type}.%i.log.gz",
  657                   "PatternLayout": {"pattern": "%d %p %c{1.} [%t] %m%n"},
  658                   "SizeBasedTriggeringPolicy": { "size": "500" }
  659                 }
  660               },
  661               { "AppenderRef": "STDOUT", "key": "Audit"}
  662             ]
  663           }
  664         }
  665       ]
  666     },
  667     "loggers": {
  668       "logger": [
  669         { "name": "EventLogger", "level": "info", "additivity": "false",
  670           "AppenderRef": { "ref": "Routing" }},
  671         { "name": "com.foo.bar", "level": "error", "additivity": "false",
  672           "AppenderRef": { "ref": "STDOUT" }}
  673       ],
  674       "root": { "level": "error", "AppenderRef": { "ref": "STDOUT" }}
  675     }
  676   }
  677 }
  678 ]]></pre>
  679           <p>
  680             Additional <a href="../runtime-dependencies.html">runtime dependencies</a> are required for using
  681             JSON configuration files.
  682           </p>
  683           <a name="YAML"/>
  684           <h4>Configuration with YAML</h4>
  685           <p>
  686             Log4j also supports using YAML for configuration files. The structure follows the same pattern as both the
  687             XML and YAML configuration formats. For example:
  688           </p>
  689           <pre class="prettyprint linenums"><![CDATA[
  690 Configuration:
  691   status: warn
  692   name: YAMLConfigTest
  693   properties:
  694     property:
  695       name: filename
  696       value: target/test-yaml.log
  697   thresholdFilter:
  698     level: debug
  699   appenders:
  700     Console:
  701       name: STDOUT
  702       PatternLayout:
  703         Pattern: "%m%n"
  704     File:
  705       name: File
  706       fileName: ${dollar}{filename}
  707       PatternLayout:
  708         Pattern: "%d %p %C{1.} [%t] %m%n"
  709       Filters:
  710         ThresholdFilter:
  711           level: error
  712 
  713   Loggers:
  714     logger:
  715       -
  716         name: org.apache.logging.log4j.test1
  717         level: debug
  718         additivity: false
  719         ThreadContextMapFilter:
  720           KeyValuePair:
  721             key: test
  722             value: 123
  723         AppenderRef:
  724           ref: STDOUT
  725       -
  726         name: org.apache.logging.log4j.test2
  727         level: debug
  728         additivity: false
  729         AppenderRef:
  730           ref: File
  731     Root:
  732       level: error
  733       AppenderRef:
  734         ref: STDOUT
  735           ]]></pre>
  736           <p>
  737             Additional <a href="../runtime-dependencies.html">runtime dependencies</a> are required for using
  738             YAML configuration files.
  739           </p>
  740           <a name="Properties"/>
  741           <h4>Configuration with Properties</h4>
  742             <p>
  743               As of version 2.4, Log4j now supports configuration via properties files. Note that the property
  744               syntax is NOT the same as the syntax used in Log4j 1. Like the XML and JSON configurations, properties
  745               configurations define the configuration in terms of plugins and attributes to the plugins.
  746             </p>
  747             <p>
  748               Prior to version 2.6,
  749               the properties configuration requires that you list the identifiers of the appenders, filters and loggers,
  750               in a comma separated list in properties with those names. Each of those components will then be expected
  751               to be defined in sets of properties that begin with <i>component.&lt;.identifier&gt;.</i>. The identifier does not
  752               have to match the name of the component being defined but must uniquely identify all the attributes and
  753               subcomponents that are part of the component. If the list of identifiers is not present the
  754               identier must not contain a '.'. Each individual component MUST have a "type" attribute
  755               specified that identifies the component's Plugin type.
  756             </p>
  757             <p>
  758               As of version 2.6, this list of identifiers is no longer required as names are inferred upon first usage,
  759               however if you wish to use more complex identifies you must still use the list. If the list is present
  760               it will be used.
  761             </p>
  762             <p>
  763               Unlike the base components, when creating subcomponents you cannot specify an element containing a list of
  764               identifiers. Instead, you must define the wrapper element with its type as is shown in the policies
  765               definition in the rolling file appender below. You then define each of the subcomponents below that
  766               wrapper element, as the TimeBasedTriggeringPolicy and SizeBasedTriggeringPolicy are defined below.
  767             </p>
  768             <p>
  769               Properties configuration files support the advertiser, monitorInterval, name, packages, shutdownHook,
  770               shutdownTimeout, status, verbose, and dest attrbutes. See <a href="#ConfigurationSyntax">Configuration Syntax</a>
  771               for the definitions of these attributes.
  772             </p>
  773           <pre class="prettyprint linenums">
  774 status = error
  775 dest = err
  776 name = PropertiesConfig
  777 
  778 property.filename = target/rolling/rollingtest.log
  779 
  780 filter.threshold.type = ThresholdFilter
  781 filter.threshold.level = debug
  782 
  783 appender.console.type = Console
  784 appender.console.name = STDOUT
  785 appender.console.layout.type = PatternLayout
  786 appender.console.layout.pattern = %m%n
  787 appender.console.filter.threshold.type = ThresholdFilter
  788 appender.console.filter.threshold.level = error
  789 
  790 appender.rolling.type = RollingFile
  791 appender.rolling.name = RollingFile
  792 appender.rolling.fileName = ${filename}
  793 appender.rolling.filePattern = target/rolling2/test1-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz
  794 appender.rolling.layout.type = PatternLayout
  795 appender.rolling.layout.pattern = %d %p %C{1.} [%t] %m%n
  796 appender.rolling.policies.type = Policies
  797 appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
  798 appender.rolling.policies.time.interval = 2
  799 appender.rolling.policies.time.modulate = true
  800 appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
  801 appender.rolling.policies.size.size=100MB
  802 appender.rolling.strategy.type = DefaultRolloverStrategy
  803 appender.rolling.strategy.max = 5
  804 
  805 logger.rolling.name = com.example.my.app
  806 logger.rolling.level = debug
  807 logger.rolling.additivity = false
  808 logger.rolling.appenderRef.rolling.ref = RollingFile
  809 
  810 rootLogger.level = info
  811 rootLogger.appenderRef.stdout.ref = STDOUT
  812           </pre>
  813           <a name="Loggers"/>
  814           <h4>Configuring loggers</h4>
  815           <p>
  816             An understanding of how loggers work in Log4j is critical before trying to configure them.
  817             Please reference the Log4j <a href="./architecture.html">architecture</a> if more information is
  818             required. Trying to configure Log4j without understanding those concepts will lead to frustration.
  819           </p>
  820           <p>
  821             A LoggerConfig is configured using the <code>logger</code> element. The <code>logger</code> element
  822             must have a name attribute specified, will usually have a level attribute specified and may
  823             also have an additivity attribute specified.  The level may be configured with one of TRACE,
  824             DEBUG, INFO, WARN, ERROR, ALL or OFF. If no level is specified it will default to ERROR. The
  825             additivity attribute may be assigned a value of true or false. If the attribute is omitted
  826             the default value of true will be used.
  827           </p>
  828           <p>
  829             A LoggerConfig (including the root LoggerConfig) can be configured with properties that will be added
  830             to the properties copied from the ThreadContextMap. These properties can be referenced from Appenders,
  831             Filters, Layouts, etc just as if they were part of the ThreadContext Map. The properties can contain
  832             variables that will be resolved either when the configuration is parsed or dynamically when each
  833             event is logged. See <a href="#PropertySubstitution">Property Substitution</a> for more information on
  834             using variables.
  835           </p>
  836           <p>
  837             The LoggerConfig may also be configured with one or more AppenderRef elements. Each appender
  838             referenced will become associated with the specified LoggerConfig. If multiple appenders
  839             are configured on the LoggerConfig each of them be called when processing logging events.
  840           </p>
  841           <p>
  842             <b><em>Every configuration must have a root logger</em></b>. If one is not configured the default root LoggerConfig,
  843             which has a level of ERROR and has a Console appender attached, will be used. The main differences
  844             between the root logger and other loggers are
  845           </p>
  846           <ol>
  847             <li>The root logger does not have a name attribute.</li>
  848             <li>The root logger does not support the additivity attribute since it has no parent.</li>
  849           </ol>
  850           <a name="Appenders"/>
  851           <h4>Configuring Appenders</h4>
  852           <p>
  853             An appender is configured either using the specific appender plugin's name or with an appender
  854             element and the type attibute containing the appender plugin's name. In addition each appender
  855             must have a name attribute specified with a value that is unique within the set of appenders.
  856             The name will be used by loggers to reference the appender as described in the previous section.
  857           </p>
  858           <p>
  859             Most appenders also support a layout to be configured (which again may be specified either
  860             using the specific Layout plugin's name as the element or with "layout" as the element name
  861             along with a type attribute that contains the layout plugin's name. The various appenders
  862             will contain other attributes or elements that are required for them to function properly.
  863           </p>
  864           <a name="Filters"/>
  865           <h4>Configuring Filters</h4>
  866           <p>
  867             Log4j allows a filter to be specified in any of 4 places:
  868           </p>
  869           <ol>
  870             <li>At the same level as the appenders, loggers and properties elements. These filters can accept
  871               or reject events before they have been passed to a LoggerConfig.</li>
  872             <li>In a logger element. These filters can accept or reject events for specific loggers.</li>
  873             <li>In an appender element. These filters can prevent or cause events to be processed by
  874               the appender.</li>
  875             <li>In an appender reference element. These filters are used to determine if a Logger should route
  876               the event to an appender.</li>
  877           </ol>
  878           <p>
  879             Although only a single <code>filter</code> element can be configured, that element may be the
  880             <code>filters</code> element which represents the CompositeFilter. The <code>filters</code> element
  881             allows any number of <code>filter</code> elements to be configured within it. The following example
  882             shows how multiple filters can be configured on the ConsoleAppender.
  883           </p>
  884           <pre class="prettyprint linenums"><![CDATA[
  885 <?xml version="1.0" encoding="UTF-8"?>
  886 <Configuration status="debug" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
  887   <Properties>
  888     <Property name="filename">target/test.log</Property>
  889   </Properties>
  890   <ThresholdFilter level="trace"/>
  891 
  892   <Appenders>
  893     <Console name="STDOUT">
  894       <PatternLayout pattern="%m MDC%X%n"/>
  895     </Console>
  896     <Console name="FLOW">
  897       <!-- this pattern outputs class name and line number -->
  898       <PatternLayout pattern="%C{1}.%M %m %ex%n"/>
  899       <filters>
  900         <MarkerFilter marker="FLOW" onMatch="ACCEPT" onMismatch="NEUTRAL"/>
  901         <MarkerFilter marker="EXCEPTION" onMatch="ACCEPT" onMismatch="DENY"/>
  902       </filters>
  903     </Console>
  904     <File name="File" fileName="${dollar}{filename}">
  905       <PatternLayout>
  906         <pattern>%d %p %C{1.} [%t] %m%n</pattern>
  907       </PatternLayout>
  908     </File>
  909   </Appenders>
  910 
  911   <Loggers>
  912     <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
  913       <ThreadContextMapFilter>
  914         <KeyValuePair key="test" value="123"/>
  915       </ThreadContextMapFilter>
  916       <AppenderRef ref="STDOUT"/>
  917     </Logger>
  918 
  919     <Logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
  920       <Property name="user">${dollar}{sys:user.name}</Property>
  921       <AppenderRef ref="File">
  922         <ThreadContextMapFilter>
  923           <KeyValuePair key="test" value="123"/>
  924         </ThreadContextMapFilter>
  925       </AppenderRef>
  926       <AppenderRef ref="STDOUT" level="error"/>
  927     </Logger>
  928 
  929     <Root level="trace">
  930       <AppenderRef ref="STDOUT"/>
  931     </Root>
  932   </Loggers>
  933 
  934 </Configuration>
  935 ]]></pre>
  936         </subsection>
  937         <a name="PropertySubstitution"/>
  938         <subsection name="Property Substitution">
  939           <p>
  940             Log4j 2 supports the ability to specify tokens in the configuration as references to properties defined
  941             elsewhere. Some of these properties will be resolved when the configuration file is interpreted while
  942             others may be passed to components where they will be evaluated at runtime. To accomplish this, Log4j
  943             uses variations of <a href="https://commons.apache.org/proper/commons-lang/">Apache Commons Lang</a>'s
  944             <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/lookup/StrSubstitutor.html">StrSubstitutor</a>
  945             and <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/lookup/StrLookup.html">StrLookup</a>
  946             classes. In a manner similar to Ant or Maven, this allows variables declared as <code>${dollar}{name}</code>
  947             to be resolved using properties declared in the configuration itself. For example, the following example
  948             shows the filename for the rolling file appender being declared as a property.
  949           </p>
  950           <pre class="prettyprint linenums"><![CDATA[
  951 <?xml version="1.0" encoding="UTF-8"?>
  952 <Configuration status="debug" name="RoutingTest" packages="org.apache.logging.log4j.test">
  953   <Properties>
  954     <Property name="filename">target/rolling1/rollingtest-${dollar}${dollar}{sd:type}.log</Property>
  955   </Properties>
  956   <ThresholdFilter level="debug"/>
  957 
  958   <Appenders>
  959     <Console name="STDOUT">
  960       <PatternLayout pattern="%m%n"/>
  961       <ThresholdFilter level="debug"/>
  962     </Console>
  963     <Routing name="Routing">
  964       <Routes pattern="${dollar}${dollar}{sd:type}">
  965         <Route>
  966           <RollingFile name="Rolling-${dollar}{sd:type}" fileName="${dollar}{filename}"
  967                        filePattern="target/rolling1/test1-${dollar}{sd:type}.%i.log.gz">
  968             <PatternLayout>
  969               <pattern>%d %p %c{1.} [%t] %m%n</pattern>
  970             </PatternLayout>
  971             <SizeBasedTriggeringPolicy size="500" />
  972           </RollingFile>
  973         </Route>
  974         <Route ref="STDOUT" key="Audit"/>
  975       </Routes>
  976     </Routing>
  977   </Appenders>
  978 
  979   <Loggers>
  980     <Logger name="EventLogger" level="info" additivity="false">
  981       <AppenderRef ref="Routing"/>
  982     </Logger>
  983 
  984     <Root level="error">
  985       <AppenderRef ref="STDOUT"/>
  986     </Root>
  987   </Loggers>
  988 
  989 </Configuration>
  990 ]]></pre>
  991           <p>
  992             While this is useful, there are many more places properties can originate from. To accommodate this,
  993             Log4j also supports the syntax <code>${dollar}{prefix:name}</code> where the prefix identifies tells Log4j
  994             that variable name should be evaluated in a specific context.
  995             See the <a href="lookups.html">Lookups</a> manual page for more details.
  996             The contexts that are built in to Logj4 are:
  997           </p>
  998             <table>
  999               <tr>
 1000                 <th>Prefix</th>
 1001                 <th>Context</th>
 1002               </tr>
 1003               <tr>
 1004                 <td>base64</td>
 1005                 <td>
 1006                   Base64 encoded data. The format is <code>${dollar}{base64:Base64_encoded_data}</code>.
 1007                   For example:
 1008                   <code>${dollar}{base64:SGVsbG8gV29ybGQhCg==}</code> yields <code>Hello World!</code>.
 1009                 </td>
 1010               </tr>
 1011               <tr>
 1012                 <td>bundle</td>
 1013                 <td>
 1014                   Resource bundle. The format is <code>${dollar}{bundle:BundleName:BundleKey}</code>.
 1015                   The bundle name follows package naming conventions, for example:
 1016                   <code>${dollar}{bundle:com.domain.Messages:MyKey}</code>.
 1017                 </td>
 1018               </tr>
 1019               <tr>
 1020                 <td>ctx</td>
 1021                 <td>Thread Context Map (MDC)</td>
 1022               </tr>
 1023               <tr>
 1024                 <td>date</td>
 1025                 <td>Inserts the current date and/or time using the specified format</td>
 1026               </tr>
 1027               <tr>
 1028                 <td>env</td>
 1029                 <td>System environment variables. The formats are <code>${dollar}{env:ENV_NAME}</code> and <code>${dollar}{env:ENV_NAME:-default_value}</code>.</td>
 1030               </tr>
 1031               <tr>
 1032                 <td>jndi</td>
 1033                 <td>A value set in the default JNDI Context.</td>
 1034               </tr>
 1035               <tr>
 1036                 <td>jvmrunargs</td>
 1037                 <td>
 1038                   A JVM input argument accessed through JMX, but not a main argument;
 1039                   see <a class="javadoc" href="http://docs.oracle.com/javase/6/docs/api/java/lang/management/RuntimeMXBean.html#getInputArguments--">RuntimeMXBean.getInputArguments()</a>.
 1040                   Not available on Android.</td>
 1041               </tr>
 1042               <tr>
 1043                 <td>log4j</td>
 1044                 <td>Log4j configuration properties. The expressions <code>${dollar}{log4j:configLocation}</code> and
 1045                   <code>${dollar}{log4j:configParentLocation}</code> respectively provide the absolute path
 1046                   to the log4j configuration file and its parent folder.</td>
 1047               </tr>
 1048               <tr>
 1049                 <td>main</td>
 1050                 <td>A value set with <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/lookup/MapLookup.html#setMainArguments-java.lang.String:A-">MapLookup.setMainArguments(String[])</a></td>
 1051               </tr>
 1052               <tr>
 1053                 <td>map</td>
 1054                 <td>A value from a MapMessage</td>
 1055               </tr>
 1056               <tr>
 1057                 <td>sd</td>
 1058                 <td>A value from a StructuredDataMessage. The key "id" will return the name of the StructuredDataId
 1059                   without the enterprise number. The key "type" will return the message type. Other keys will
 1060                   retrieve individual elements from the Map.</td>
 1061               </tr>
 1062               <tr>
 1063                 <td>sys</td>
 1064                 <td>System properties. The formats are <code>${dollar}{sys:some.property}</code> and <code>${dollar}{sys:some.property:-default_value}</code>.</td>
 1065               </tr>
 1066             </table>
 1067           <a name="DefaultProperties"/><h3>Default Properites</h3><p>
 1068           A default property map can be declared in the configuration file by placing a Properties
 1069           element directly after the Configuration element and before any Loggers, Filters,
 1070           Appenders, etc. are declared. If the value cannot be located in the specified lookup the
 1071           value in the default property map will be used. The default map is pre-populated with a value
 1072           for "hostName" that is the current system's host name or IP address and
 1073           the "contextName" with is the value of the current logging context. See many places
 1074           a Properties element is used in this section for examples.
 1075           </p>
 1076         </subsection>
 1077         <a name="RuntimeLookup"/>
 1078         <subsection name="Lookup Variables with Multiple Leading '$' Characters">
 1079           <p>
 1080             An interesting feature of StrLookup processing is that when a variable reference is declared with
 1081             multiple leading '$' characters each time the variable is resolved the leading '$' is simply removed.
 1082             In the previous example the "Routes" element is capable of resolving the variable at runtime. To allow
 1083             this the prefix value is specified as a variable with two leading '$' characters. When the configuration
 1084             file is first processed the first '$' character is simply removed. Thus, when the Routes element is evaluated
 1085             at runtime it is the variable declaration "${dollar}{sd:type}" which causes the event to be inspected for a
 1086             StructuredDataMessage and if one is present the value of its type attribute to be used as the routing key.
 1087             Not all elements support resolving variables at runtime. Components that do will specifically call that
 1088             out in their documentation.
 1089           </p>
 1090           <p>
 1091             If no value is found for the key in the Lookup associated with the prefix then the value associated with
 1092             the key in the properties declaration in the configuration file will be used. If no value is found
 1093             the variable declaration will be returned as the value. Default values may be declared in the configuration
 1094             by doing:
 1095           </p>
 1096           <pre class="prettyprint linenums"><![CDATA[
 1097 <?xml version="1.0" encoding="UTF-8"?>
 1098 <Configuration>
 1099   <Properties>
 1100     <Property name="type">Audit</property>
 1101   </Properties>
 1102   ...
 1103 </Configuration>
 1104 ]]></pre>
 1105           <p>
 1106             <i>As a footnote, it is worth pointing out that the variables in the RollingFile appender declaration
 1107             will also not be evaluated when the configuration is processed. This is simply because the resolution
 1108             of the whole RollingFile element is deferred until a match occurs.
 1109             See <a href="appenders.html#RoutingAppender">RoutingAppender</a> for more information.</i>
 1110           </p>
 1111         </subsection>
 1112         <a name="Scripts"/>
 1113         <subsection name="Scripts">
 1114           <p>
 1115             Log4j provides support for <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/">JSR 223</a>
 1116             scripting languages to be used in some of its components. Any language that provides support for the JSR
 1117             223 scripting engine may be used. A list of the languages and bindings for them can be found at the
 1118             <a href="https://java.net/projects/scripting/sources/svn/show/trunk/engines">Scripting Engine</a> web site.
 1119             However, some of the languages listed there, such as JavaScript, Groovy and Beanshell, directly support the
 1120             JSR 223 scripting framework and only require that the jars for that language be installed.
 1121           </p>
 1122           <p>
 1123             The components that support using scripts do so by allowing a &lt;script&gt;, &lt;scriptFile&gt;, or
 1124             &lt;scriptRef&gt; element to be configured on
 1125             them. The script element contains a name for the script, the language of the script, and the script text.
 1126             The scriptFile element contains the name of the script, its location, its language, its charset, and
 1127             whether the file should be watched for changes. The scriptRef element contains the name of the
 1128             script that is defined in the &lt;scripts&gt; configuration element.
 1129             The name of the script is used to store the script, along with its ScriptEngine, so it can quickly be
 1130             located each time the script needs to be run. While the name is not required, providing it will help in
 1131             debugging problems when the script is running. The language must be provided on the script element and must
 1132             specify one of the language names that appear in the Configuration status log as described in the next
 1133             section. If the language is not specified on the scriptFile element the language will be determined by
 1134             the file extension of the script path. If file monitoring is requested it will only be enabled if
 1135             a non-zero monitorInterval is specified on the configuration element. That interval will be used to
 1136             check for changes in the file.
 1137           </p>
 1138           <pre class="prettyprint linenums"><![CDATA[
 1139 <?xml version="1.0" encoding="UTF-8"?>
 1140 <Configuration status="debug" name="RoutingTest">
 1141   <Scripts>
 1142     <Script name="selector" language="javascript"><![CDATA[
 1143             var result;
 1144             if (logEvent.getLoggerName().equals("JavascriptNoLocation")) {
 1145                 result = "NoLocation";
 1146             } else if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf("FLOW")) {
 1147                 result = "Flow";
 1148             }
 1149             result;
 1150             ]]]]><![CDATA[></Script>
 1151     <ScriptFile name="groovy.filter" path="scripts/filter.groovy"/>
 1152   </Scripts>
 1153 
 1154   <Appenders>
 1155     <Console name="STDOUT">
 1156       <ScriptPatternSelector defaultPattern="%d %p %m%n">
 1157         <ScriptRef ref="selector"/>
 1158           <PatternMatch key="NoLocation" pattern="[%-5level] %c{1.} %msg%n"/>
 1159           <PatternMatch key="Flow" pattern="[%-5level] %c{1.} ====== %C{1.}.%M:%L %msg ======%n"/>
 1160       </ScriptPatternSelector>
 1161       <PatternLayout pattern="%m%n"/>
 1162     </Console>
 1163   </Appenders>
 1164 
 1165   <Loggers>
 1166     <Logger name="EventLogger" level="info" additivity="false">
 1167         <ScriptFilter onMatch="ACCEPT" onMisMatch="DENY">
 1168           <Script name="GroovyFilter" language="groovy"><![CDATA[
 1169             if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf("FLOW")) {
 1170                 return true;
 1171             } else if (logEvent.getContextMap().containsKey("UserId")) {
 1172                 return true;
 1173             }
 1174             return false;
 1175             ]]]]><![CDATA[>
 1176           </Script>
 1177         </ScriptFilter>
 1178       <AppenderRef ref="STDOUT"/>
 1179     </Logger>
 1180 
 1181     <Root level="error">
 1182       <ScriptFilter onMatch="ACCEPT" onMisMatch="DENY">
 1183         <ScriptRef ref="groovy.filter"/>
 1184       </ScriptFilter>
 1185       <AppenderRef ref="STDOUT"/>
 1186     </Root>
 1187   </Loggers>
 1188 
 1189 </Configuration>]]>
 1190           </pre>
 1191           <p>
 1192             If the status attribute on the Configuration element is set to DEBUG the list of script engines currently
 1193             installed and their attributes will be listed. Although some engines may say they are not thread safe,
 1194             Log4j takes steps to insure that the scripts will run in a thread-safe manner if the engine advertises
 1195             that it is not thread safe.
 1196           </p>
 1197           <pre>
 1198 2015-09-27 16:13:22,925 main DEBUG Installed script engines
 1199 2015-09-27 16:13:22,963 main DEBUG AppleScriptEngine Version: 1.1, Language: AppleScript, Threading: Not Thread Safe,
 1200             Compile: false, Names: {AppleScriptEngine, AppleScript, OSA}
 1201 2015-09-27 16:13:22,983 main DEBUG Groovy Scripting Engine Version: 2.0, Language: Groovy, Threading: MULTITHREADED,
 1202             Compile: true, Names: {groovy, Groovy}
 1203 2015-09-27 16:13:23,030 main DEBUG BeanShell Engine Version: 1.0, Language: BeanShell, Threading: MULTITHREADED,
 1204             Compile: true, Names: {beanshell, bsh, java}
 1205 2015-09-27 16:13:23,039 main DEBUG Mozilla Rhino Version: 1.7 release 3 PRERELEASE, Language: ECMAScript, Threading: MULTITHREADED,
 1206             Compile: true, Names: {js, rhino, JavaScript, javascript, ECMAScript, ecmascript}
 1207           </pre>
 1208           <p>
 1209             When the scripts are executed they will be provided with a set of variables that should allow them to
 1210             accomplish whatever task they are expected to perform. See the documentation for the individual components
 1211             for the list of variables that are available to the script.
 1212           </p>
 1213           <p>
 1214             The components that support scripting expect a return value to be passed back to the calling Java code.
 1215             This is not a problem for several of the scripting languages, but Javascript does not allow a
 1216             return statement unless it is within a function. However, Javascript will return the value of the last
 1217             statement executed in the script. As a consequence, code such as that shown below will result in the
 1218             desired behavior.
 1219           </p>
 1220           <pre><![CDATA[
 1221             var result;
 1222             if (logEvent.getLoggerName().equals("JavascriptNoLocation")) {
 1223                 result = "NoLocation";
 1224             } else if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf("FLOW")) {
 1225                 result = "Flow";
 1226             }
 1227             result;
 1228           ]]></pre>
 1229           <h4>A special note on Beanshell</h4>
 1230           <p>
 1231             JSR 223 scripting engines are supposed to identify that they support the Compilable interface if they
 1232             support compiling their scripts. Beanshell does this. However, whenever the compile method is called it
 1233             throws an Error (not an Exception). Log4j catches this but will log the warning shown below for each
 1234             Beanshell script when it tries to compile them. All Beanshell scripts will then be interpreted on each
 1235             execution.
 1236           </p>
 1237           <pre><![CDATA[
 1238 2015-09-27 16:13:23,095 main DEBUG Script BeanShellSelector is compilable
 1239 2015-09-27 16:13:23,096 main WARN Error compiling script java.lang.Error: unimplemented
 1240             at bsh.engine.BshScriptEngine.compile(BshScriptEngine.java:175)
 1241             at bsh.engine.BshScriptEngine.compile(BshScriptEngine.java:154)
 1242             at org.apache.logging.log4j.core.script.ScriptManager$MainScriptRunner.<init>(ScriptManager.java:125)
 1243             at org.apache.logging.log4j.core.script.ScriptManager.addScript(ScriptManager.java:94)
 1244           ]]></pre>
 1245         </subsection>
 1246         <a name="XInclude"/>
 1247         <subsection name="XInclude">
 1248           <p>
 1249             XML configuration files can include other files with <a href="http://www.xml.com/lpt/a/1009">XInclude</a>.
 1250             Here is an example log4j2.xml file that includes two other files:
 1251           </p>
 1252           <pre class="prettyprint linenums"><![CDATA[
 1253 <?xml version="1.0" encoding="UTF-8"?>
 1254 <configuration xmlns:xi="http://www.w3.org/2001/XInclude"
 1255                status="warn" name="XIncludeDemo">
 1256   <properties>
 1257     <property name="filename">xinclude-demo.log</property>
 1258   </properties>
 1259   <ThresholdFilter level="debug"/>
 1260   <xi:include href="log4j-xinclude-appenders.xml" />
 1261   <xi:include href="log4j-xinclude-loggers.xml" />
 1262 </configuration>
 1263 ]]></pre>
 1264           <p>log4j-xinclude-appenders.xml:</p>
 1265           <pre class="prettyprint linenums"><![CDATA[
 1266 <?xml version="1.0" encoding="UTF-8"?>
 1267 <appenders>
 1268   <Console name="STDOUT">
 1269     <PatternLayout pattern="%m%n" />
 1270   </Console>
 1271   <File name="File" fileName="${dollar}{filename}" bufferedIO="true" immediateFlush="true">
 1272     <PatternLayout>
 1273       <pattern>%d %p %C{1.} [%t] %m%n</pattern>
 1274     </PatternLayout>
 1275   </File>
 1276 </appenders>
 1277 ]]></pre>
 1278           <p>log4j-xinclude-loggers.xml:</p>
 1279           <pre class="prettyprint linenums"><![CDATA[
 1280 <?xml version="1.0" encoding="UTF-8"?>
 1281 <loggers>
 1282   <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
 1283     <ThreadContextMapFilter>
 1284       <KeyValuePair key="test" value="123" />
 1285     </ThreadContextMapFilter>
 1286     <AppenderRef ref="STDOUT" />
 1287   </logger>
 1288 
 1289   <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
 1290     <AppenderRef ref="File" />
 1291   </logger>
 1292 
 1293   <root level="error">
 1294     <AppenderRef ref="STDOUT" />
 1295   </root>
 1296 </loggers>
 1297 ]]></pre>
 1298         </subsection>
 1299         <a name="CompositeConfiguration"/>
 1300         <subsection name="Composite Configuration">
 1301             <p>
 1302               Log4j allows multiple configuration files to be used by specifying them as a list of comma separated
 1303               file paths on log4j.configurationFile.  The merge logic can be controlled by specifying a class
 1304                 that implements the MergeStrategy interface on the log4j.mergeStrategy property. The default
 1305                 merge strategy will merge the files using the following rules:
 1306               <ol>
 1307                 <li>The global configuration attributes are aggregated with those in later configurations replacing
 1308                   those in previous configurations, with the exception that the highest status level and the lowest
 1309                   monitorInterval greater than 0 will be used.</li>
 1310                 <li>Properties from all configurations are aggregated. Duplicate properties replace those in previous
 1311                   configurations.</li>
 1312                 <li>Filters are aggregated under a CompositeFilter if more than one Filter is defined. Since Filters
 1313                   are not named duplicates may be present.</li>
 1314                 <li>Scripts and ScriptFile references are aggregated. Duplicate definiations replace those in previous
 1315                   configurations.</li>
 1316                 <li>Appenders are aggregated. Appenders with the same name are replaced by those in later
 1317                   configurations, including all of the Appender's subcomponents.</li>
 1318                 <li>Loggers are all aggregated. Logger attributes are individually merged with duplicates being
 1319                   replaced by those in later configurations. Appender references on a Logger are aggregated with
 1320                   duplicates being replaced by those in later configurations. Filters on a Logger are aggregated
 1321                   under a CompositeFilter if more than one Filter is defined. Since Filters are not named
 1322                   duplicates may be present. Filters under Appender references included or discarded depending on
 1323                   whether their parent Appender reference is kept or discarded.</li>
 1324                 </ol>
 1325             </p>
 1326         </subsection>
 1327         <a name="StatusMessages"/>
 1328         <subsection name="Status Messages">
 1329           <table>
 1330             <tr>
 1331             <td>
 1332             <b>Troubleshooting tip for the impatient:</b>
 1333               <p>From log4j-2.9 onward, log4j2 will print all internal logging to the console if system property
 1334                 <tt>log4j2.debug</tt> is defined (with any or no value).</p>
 1335               <p>Prior to log4j-2.9, there are two places where internal logging can be controlled:</p>
 1336             <ul>
 1337               <li>Before a configuration is found, status logger level can be controlled with system
 1338               property <code>org.apache.logging.log4j.simplelog.StatusLogger.level</code>.</li>
 1339               <li>After a configuration is found, status logger level can be controlled in the configuration
 1340               file with the "status" attribute, for example: <code>&lt;Configuration status="trace"&gt;</code>.</li>
 1341             </ul>
 1342             </td>
 1343             </tr>
 1344           </table>
 1345           <p>
 1346             Just as it is desirable to be able to diagnose problems in applications, it is frequently necessary
 1347             to be able to diagnose problems in the logging configuration or in the configured components. Since
 1348             logging has not been configured, "normal" logging cannot be used during initialization. In addition,
 1349             normal logging within appenders could create infinite recursion which Log4j will detect and cause
 1350             the recursive events to be ignored. To accomodate this need, the Log4j 2 API includes a
 1351             <a class="javadoc" href="../log4j-api/apidocs/org/apache/logging/log4j/status/StatusLogger.html">StatusLogger</a>.
 1352             Components declare an instance of the StatusLogger similar to:
 1353           </p>
 1354           <pre class="prettyprint">protected final static Logger logger = StatusLogger.getLogger();</pre>
 1355           <p>
 1356             Since StatusLogger implements the Log4j 2 API's Logger interface, all the normal Logger methods may
 1357             be used.
 1358           </p>
 1359           <p>
 1360             When configuring Log4j it is sometimes necessary to view the generated status events. This can be
 1361             accomplished by adding the status attribute to the configuration element or a default value can be
 1362             provided by setting the "Log4jDefaultStatusLevel" system property.  Valid values of the status attribute are
 1363             "trace", "debug", "info", "warn", "error" and "fatal". The following
 1364             configuration has the status attribute set to debug.
 1365           </p>
 1366 
 1367           <pre class="prettyprint linenums"><![CDATA[
 1368 <?xml version="1.0" encoding="UTF-8"?>
 1369 <Configuration status="debug" name="RoutingTest">
 1370   <Properties>
 1371     <Property name="filename">target/rolling1/rollingtest-${dollar}${dollar}{sd:type}.log</Property>
 1372   </Properties>
 1373   <ThresholdFilter level="debug"/>
 1374 
 1375   <Appenders>
 1376     <Console name="STDOUT">
 1377       <PatternLayout pattern="%m%n"/>
 1378       <ThresholdFilter level="debug"/>
 1379     </Console>
 1380     <Routing name="Routing">
 1381       <Routes pattern="${dollar}${dollar}{sd:type}">
 1382         <Route>
 1383           <RollingFile name="Rolling-${dollar}{sd:type}" fileName="${dollar}{filename}"
 1384                        filePattern="target/rolling1/test1-${dollar}{sd:type}.%i.log.gz">
 1385             <PatternLayout>
 1386               <pattern>%d %p %c{1.} [%t] %m%n</pattern>
 1387             </PatternLayout>
 1388             <SizeBasedTriggeringPolicy size="500" />
 1389           </RollingFile>
 1390         </Route>
 1391         <Route ref="STDOUT" key="Audit"/>
 1392       </Routes>
 1393     </Routing>
 1394   </Appenders>
 1395 
 1396   <Loggers>
 1397     <Logger name="EventLogger" level="info" additivity="false">
 1398       <AppenderRef ref="Routing"/>
 1399     </Logger>
 1400 
 1401     <Root level="error">
 1402       <AppenderRef ref="STDOUT"/>
 1403     </Root>
 1404   </Loggers>
 1405 
 1406 </Configuration>
 1407 ]]></pre>
 1408             <p>
 1409             During startup this configuration produces:
 1410             </p>
 1411 #if ($isPDF)
 1412     <pre>
 1413 2011-11-23 17:08:00,769 DEBUG Generated plugins in 0.003374000 seconds
 1414 2011-11-23 17:08:00,789 DEBUG Calling createProperty on class org.apache.logging.log4j.core.
 1415        config.Property for element property with params(name="filename",
 1416        value="target/rolling1/rollingtest-${dollar}{sd:type}.log")
 1417 2011-11-23 17:08:00,792 DEBUG Calling configureSubstitutor on class org.apache.logging.log4j.
 1418        core.config.plugins.PropertiesPlugin for element properties with
 1419        params(properties={filename=target/rolling1/rollingtest-${dollar}{sd:type}.log})
 1420 2011-11-23 17:08:00,794 DEBUG Generated plugins in 0.001362000 seconds
 1421 2011-11-23 17:08:00,797 DEBUG Calling createFilter on class org.apache.logging.log4j.core.
 1422        filter.ThresholdFilter for element ThresholdFilter with params(level="debug",
 1423        onMatch="null", onMismatch="null")
 1424 2011-11-23 17:08:00,800 DEBUG Calling createLayout on class org.apache.logging.log4j.core.
 1425        layout.PatternLayout for element PatternLayout with params(pattern="%m%n",
 1426        Configuration(RoutingTest), null, charset="null")
 1427 2011-11-23 17:08:00,802 DEBUG Generated plugins in 0.001349000 seconds
 1428 2011-11-23 17:08:00,804 DEBUG Calling createAppender on class org.apache.logging.log4j.core.
 1429        appender.ConsoleAppender for element Console with params(PatternLayout(%m%n), null,
 1430        target="null", name="STDOUT", ignoreExceptions="null")
 1431 2011-11-23 17:08:00,804 DEBUG Calling createFilter on class org.apache.logging.log4j.core.
 1432        filter.ThresholdFilter for element ThresholdFilter with params(level="debug",
 1433        onMatch="null", onMismatch="null")
 1434 2011-11-23 17:08:00,813 DEBUG Calling createRoute on class org.apache.logging.log4j.core.appender.
 1435        routing.Route for element Route with params(AppenderRef="null", key="null", Node=Route)
 1436 2011-11-23 17:08:00,823 DEBUG Calling createRoute on class org.apache.logging.log4j.core.appender.
 1437        routing.Route for element Route with params(AppenderRef="STDOUT", key="Audit", Node=Route)
 1438 2011-11-23 17:08:00,825 DEBUG Calling createRoutes on class org.apache.logging.log4j.core.appender.
 1439        routing.Routes for element Routes with params(pattern="${dollar}{sd:type}",
 1440        routes={Route(type=dynamic default), Route(type=static Reference=STDOUT key='Audit'))})
 1441 2011-11-23 17:08:00,827 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.
 1442        routing.RoutingAppender for element Routing with params(name="Routing",
 1443       ignoreExceptions="null", Routes({Route(type=dynamic default),Route(type=static
 1444        Reference=STDOUT key='Audit')}), Configuration(RoutingTest), null, null)
 1445 2011-11-23 17:08:00,827 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.
 1446        plugins.AppendersPlugin for element appenders with params(appenders={STDOUT, Routing})
 1447 2011-11-23 17:08:00,828 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.
 1448        config.plugins.AppenderRefPlugin for element AppenderRef with params(ref="Routing")
 1449 2011-11-23 17:08:00,829 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.
 1450        LoggerConfig for element logger with params(additivity="false", level="info", name="EventLogger",
 1451        AppenderRef={Routing}, null)
 1452 2011-11-23 17:08:00,830 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.
 1453        config.plugins.AppenderRefPlugin for element AppenderRef with params(ref="STDOUT")</pre>
 1454             <pre>
 1455 2011-11-23 17:08:00,831 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.
 1456        LoggerConfig${dollar}RootLogger for element root with params(additivity="null", level="error",
 1457        AppenderRef={STDOUT}, null)
 1458 2011-11-23 17:08:00,833 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.
 1459        config.plugins.LoggersPlugin for element loggers with params(loggers={EventLogger, root})
 1460 2011-11-23 17:08:00,834 DEBUG Reconfiguration completed
 1461 2011-11-23 17:08:00,846 DEBUG Calling createLayout on class org.apache.logging.log4j.core.
 1462        layout.PatternLayout for element PatternLayout with params(pattern="%d %p %c{1.} [%t] %m%n",
 1463        Configuration(RoutingTest), null, charset="null")
 1464 2011-11-23 17:08:00,849 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.
 1465        appender.rolling.SizeBasedTriggeringPolicy for element SizeBasedTriggeringPolicy with
 1466        params(size="500")
 1467 2011-11-23 17:08:00,851 DEBUG Calling createAppender on class org.apache.logging.log4j.core.
 1468        appender.RollingFileAppender for element RollingFile with
 1469        params(fileName="target/rolling1/rollingtest-Unknown.log",
 1470        filePattern="target/rolling1/test1-Unknown.%i.log.gz", append="null", name="Rolling-Unknown",
 1471        bufferedIO="null", immediateFlush="null",
 1472        SizeBasedTriggeringPolicy(SizeBasedTriggeringPolicy(size=500)), null,
 1473        PatternLayout(%d %p %c{1.} [%t] %m%n), null, ignoreExceptions="null")
 1474 2011-11-23 17:08:00,858 DEBUG Generated plugins in 0.002014000 seconds
 1475 2011-11-23 17:08:00,889 DEBUG Reconfiguration started for context sun.misc.
 1476        Launcher${dollar}AppClassLoader@37b90b39
 1477 2011-11-23 17:08:00,890 DEBUG Generated plugins in 0.001355000 seconds
 1478 2011-11-23 17:08:00,959 DEBUG Generated plugins in 0.001239000 seconds
 1479 2011-11-23 17:08:00,961 DEBUG Generated plugins in 0.001197000 seconds
 1480 2011-11-23 17:08:00,965 WARN No Loggers were configured, using default
 1481 2011-11-23 17:08:00,976 DEBUG Reconfiguration completed</pre>
 1482 #else
 1483 <pre>
 1484 2011-11-23 17:08:00,769 DEBUG Generated plugins in 0.003374000 seconds
 1485 2011-11-23 17:08:00,789 DEBUG Calling createProperty on class org.apache.logging.log4j.core.config.Property for element property with params(name="filename", value="target/rolling1/rollingtest-${dollar}{sd:type}.log")
 1486 2011-11-23 17:08:00,792 DEBUG Calling configureSubstitutor on class org.apache.logging.log4j.core.config.PropertiesPlugin for element properties with params(properties={filename=target/rolling1/rollingtest-${dollar}{sd:type}.log})
 1487 2011-11-23 17:08:00,794 DEBUG Generated plugins in 0.001362000 seconds
 1488 2011-11-23 17:08:00,797 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="debug", onMatch="null", onMismatch="null")
 1489 2011-11-23 17:08:00,800 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%m%n", Configuration(RoutingTest), null, charset="null")
 1490 2011-11-23 17:08:00,802 DEBUG Generated plugins in 0.001349000 seconds
 1491 2011-11-23 17:08:00,804 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%m%n), null, target="null", name="STDOUT", ignoreExceptions="null")
 1492 2011-11-23 17:08:00,804 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="debug", onMatch="null", onMismatch="null")
 1493 2011-11-23 17:08:00,813 DEBUG Calling createRoute on class org.apache.logging.log4j.core.appender.routing.Route for element Route with params(AppenderRef="null", key="null", Node=Route)
 1494 2011-11-23 17:08:00,823 DEBUG Calling createRoute on class org.apache.logging.log4j.core.appender.routing.Route for element Route with params(AppenderRef="STDOUT", key="Audit", Node=Route)
 1495 2011-11-23 17:08:00,825 DEBUG Calling createRoutes on class org.apache.logging.log4j.core.appender.routing.Routes for element Routes with params(pattern="${dollar}{sd:type}", routes={Route(type=dynamic default), Route(type=static Reference=STDOUT key='Audit')})
 1496 2011-11-23 17:08:00,827 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.routing.RoutingAppender for element Routing with params(name="Routing", ignoreExceptions="null", Routes({Route(type=dynamic default),Route(type=static Reference=STDOUT key='Audit')}), Configuration(RoutingTest), null, null)
 1497 2011-11-23 17:08:00,827 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.AppendersPlugin for element appenders with params(appenders={STDOUT, Routing})
 1498 2011-11-23 17:08:00,828 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.plugins.AppenderRefPlugin for element AppenderRef with params(ref="Routing")
 1499 2011-11-23 17:08:00,829 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="info", name="EventLogger", AppenderRef={Routing}, null)
 1500 2011-11-23 17:08:00,830 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.plugins.AppenderRefPlugin for element AppenderRef with params(ref="STDOUT")
 1501 2011-11-23 17:08:00,831 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig${dollar}RootLogger for element root with params(additivity="null", level="error", AppenderRef={STDOUT}, null)
 1502 2011-11-23 17:08:00,833 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.LoggersPlugin for element loggers with params(loggers={EventLogger, root})
 1503 2011-11-23 17:08:00,834 DEBUG Reconfiguration completed
 1504 2011-11-23 17:08:00,846 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d %p %c{1.} [%t] %m%n", Configuration(RoutingTest), null, charset="null")
 1505 2011-11-23 17:08:00,849 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy for element SizeBasedTriggeringPolicy with params(size="500")
 1506 2011-11-23 17:08:00,851 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile with params(fileName="target/rolling1/rollingtest-Unknown.log", filePattern="target/rolling1/test1-Unknown.%i.log.gz", append="null", name="Rolling-Unknown", bufferedIO="null", immediateFlush="null", SizeBasedTriggeringPolicy(SizeBasedTriggeringPolicy(size=500)), null, PatternLayout(%d %p %c{1.} [%t] %m%n), null, ignoreExceptions="null")
 1507 2011-11-23 17:08:00,858 DEBUG Generated plugins in 0.002014000 seconds
 1508 2011-11-23 17:08:00,889 DEBUG Reconfiguration started for context sun.misc.Launcher${dollar}AppClassLoader@37b90b39
 1509 2011-11-23 17:08:00,890 DEBUG Generated plugins in 0.001355000 seconds
 1510 2011-11-23 17:08:00,959 DEBUG Generated plugins in 0.001239000 seconds
 1511 2011-11-23 17:08:00,961 DEBUG Generated plugins in 0.001197000 seconds
 1512 2011-11-23 17:08:00,965 WARN No Loggers were configured, using default
 1513 2011-11-23 17:08:00,976 DEBUG Reconfiguration completed</pre>
 1514 #end
 1515           <p>
 1516             If the status attribute is set to error than only error messages will be written to the console. This
 1517             makes troubleshooting configuration errors possible. As an example, if the configuration above is changed
 1518             to have the status set to error and the logger declaration is:</p>
 1519           <pre class="prettyprint linenums"><![CDATA[
 1520 <logger name="EventLogger" level="info" additivity="false">
 1521   <AppenderRef ref="Routng"/>
 1522 </logger>
 1523 ]]></pre>
 1524           <p>
 1525             the following error message will be produced.
 1526           </p>
 1527           <pre>2011-11-24 23:21:25,517 ERROR Unable to locate appender Routng for logger EventLogger</pre>
 1528           <p>
 1529             Applications may wish to direct the status output to some other destination. This can be accomplished
 1530             by setting the dest attribute to either "err" to send the output to stderr or to a file location or URL.
 1531             This can also be done by insuring the configured status is set to OFF and then configuring the application
 1532             programmatically such as:
 1533           </p>
 1534 <pre class="prettyprint linenums"><![CDATA[
 1535 StatusConsoleListener listener = new StatusConsoleListener(Level.ERROR);
 1536 StatusLogger.getLogger().registerListener(listener);
 1537 ]]></pre>
 1538         </subsection>
 1539         <a name="UnitTestingInMaven"/>
 1540         <subsection name="Testing in Maven">
 1541         <p>
 1542           Maven can run unit and functional tests during the build cycle. By default, any files placed in
 1543           <code>src/test/resources</code> are automatically copied to target/test-classes and are included
 1544           in the classpath during execution of any tests. As such, placing a log4j2-test.xml into this directory
 1545           will cause it to be used instead of a log4j2.xml or log4j2.json that might be present.  Thus a different
 1546           log configuration can be used during testing than what is used in production.
 1547         </p>
 1548         <p>
 1549           A second approach, which is extensively used by Log4j 2, is to set the log4j.configurationFile property
 1550           in the method annotated with @BeforeClass in the junit test class. This will allow an arbitrarily
 1551           named file to be used during the test.
 1552         </p>
 1553           <p>
 1554             A third approach, also used extensively by Log4j 2, is to use the <code>LoggerContextRule</code>
 1555             JUnit test rule which provides additional convenience methods for testing. This requires adding the
 1556             <code>log4j-core</code> <code>test-jar</code> dependency to your test scope dependencies. For example:
 1557           </p>
 1558           <pre class="prettyprint linenums"><![CDATA[
 1559 public class AwesomeTest {
 1560     @Rule
 1561     public LoggerContextRule init = new LoggerContextRule("MyTestConfig.xml");
 1562 
 1563     @Test
 1564     public void testSomeAwesomeFeature() {
 1565         final LoggerContext ctx = init.getLoggerContext();
 1566         final Logger logger = init.getLogger("org.apache.logging.log4j.my.awesome.test.logger");
 1567         final Configuration cfg = init.getConfiguration();
 1568         final ListAppender app = init.getListAppender("List");
 1569         logger.warn("Test message");
 1570         final List<LogEvent> events = app.getEvents();
 1571         // etc.
 1572     }
 1573 }
 1574 ]]></pre>
 1575         </subsection>
 1576         <a name="SystemProperties"/>
 1577         <subsection name="System Properties">
 1578         <p>
 1579           The Log4j documentation references a number of System Properties that can be used to control various aspects
 1580           of Log4j 2 behavior. The table below lists these properties along with their default value and a
 1581           description of what they control.
 1582           Any spaces present in the property name are for visual flow and should be removed.
 1583         </p>
 1584           <p>
 1585             Note that beginning in Log4j 2.10, all system property names have been normalized to follow a consistent
 1586             naming scheme. While the old property names are still supported for backwards compatibility, it is
 1587             recommended to update configurations to use the new style. This system is extensible and is enabled
 1588             through the
 1589             <a class="javadoc" href="../log4j-api/apidocs/org/apache/logging/log4j/util/PropertySource.html">PropertySource</a>
 1590             interface. Additional property source classes can be added through the standard <code>ServiceLoader</code>
 1591             mechanism in Java SE.
 1592           </p>
 1593           <p>
 1594             Properties can be overridden by sources with a lower number priority (e.g.., -100 comes before 100). The
 1595             following sources are all available by default:
 1596           </p>
 1597           <table>
 1598             <caption align="top">PropertySource priorities and descriptions</caption>
 1599             <tr>
 1600               <th>Source</th>
 1601               <th>Priority</th>
 1602               <th>Description</th>
 1603             </tr>
 1604             <tr>
 1605               <td>Environment Variables</td>
 1606               <td>-100</td>
 1607               <td>
 1608                 Environment variables are all prefixed with <code>LOG4J_</code>, are in all caps, and words are all
 1609                 separated by underscores. Only this naming scheme is support for environment variables as there were
 1610                 no old naming schemes to maintain compatibility with.
 1611               </td>
 1612             </tr>
 1613             <tr>
 1614               <td><code>log4j2.component.properties</code> file</td>
 1615               <td>0</td>
 1616               <td>
 1617                 Including this file on the classpath can be used as an alternative to providing properties as system
 1618                 properties. This has priority over system properties, but they can be overridden by environment
 1619                 variables as described above.
 1620               </td>
 1621             </tr>
 1622             <tr>
 1623               <td>System Properties</td>
 1624               <td>100</td>
 1625               <td>
 1626                 All properties can be set using normal system property patterns. These have the lowest priority and
 1627                 can be overridden by included properties files or environment variables.
 1628               </td>
 1629             </tr>
 1630           </table>
 1631           <p>
 1632             The following is a list of available global configuration properties. Note that these can only be set once
 1633             per JVM process unlike configuration settings available in configuration files. The <i>Property Name</i>
 1634             column contains the name used in properties files and system properties; <i>Environemt Variable</i>
 1635             for the equivalent environment variable; and <i>Legacy Property Name</i> for the pre-2.10 name.
 1636           </p>
 1637 <style>
 1638   * { // this works for all but td
 1639   word-wrap:break-word;
 1640   }
 1641 
 1642   table { // this somehow makes it work for td
 1643   table-layout:fixed;
 1644   width:100%;
 1645   }
 1646 </style>
 1647 <table style="table-layout: fixed; width: 100%">
 1648   <caption align="top">Log4j 2 global configuration properties</caption>
 1649   <tr>
 1650     <th>Property Name <br /> (Legacy Property Name)</th>
 1651     <th>Environment Variable</th>
 1652     <th>Default Value</th>
 1653     <th>Description</th>
 1654   </tr>
 1655 
 1656   <tr>
 1657     <td><a name="configurationFile"/>log4j2.configurationFile
 1658       <br />
 1659       (<a name="log4j.configurationFile"/>log4j.configurationFile)
 1660     </td>
 1661     <td>LOG4J_CONFIGURATION_FILE</td>
 1662     <td>&nbsp;</td>
 1663     <td>
 1664       Path to an Log4j 2 configuration file. May also contain a comma separated list of configuration file names.
 1665     </td>
 1666   </tr>
 1667   <tr>
 1668     <td><a name="debug"/>log4j2.debug
 1669       <br />
 1670       (<a name="log4j2.debug"/>log4j2.debug)
 1671     </td>
 1672     <td>LOG4J_DEBUG</td>
 1673     <td>&nbsp;</td>
 1674     <td>
 1675       Log4j2 will print all internal logging to the console if system property
 1676       <tt>log4j2.debug</tt> is defined (with any or no value).
 1677     </td>
 1678   </tr>
 1679   <tr>
 1680     <td><a name="mergeFactory"/>log4j2.mergeFactory
 1681       <br />
 1682       (<a name="log4j.mergeFactory"/>log4j.mergeFactory)
 1683     </td>
 1684     <td>LOG4J_MERGE_FACTORY</td>
 1685     <td>&nbsp;</td>
 1686     <td>
 1687       The name of the class that implements the MergeStrategy interface. If not specified
 1688       <code>DefaultMergeStrategy</code> will be used when creating a CompositeConfiguration..
 1689     </td>
 1690   </tr>
 1691   <tr>
 1692     <td><a name="contextSelector"/>log4j2.contextSelector
 1693       <br />
 1694       (<a name="Log4jContextSelector"/>Log4jContextSelector)
 1695     </td>
 1696     <td>LOG4J_CONTEXT_SELECTOR</td>
 1697     <td>ClassLoaderContextSelector</td>
 1698     <td>
 1699       Creates the <tt>LoggerContext</tt>s. An application can have one or more active LoggerContexts depending
 1700       on the circumstances.
 1701       See <a href="logsep.html">Log Separation</a> for more details.
 1702       Available context selector implementation classes:<br />
 1703     <!-- deliberately inserted spaces to allow line break -->
 1704       <tt>org.apache.logging.log4j.core.async .AsyncLoggerContextSelector</tt> - makes <a href="async.html">all loggers asynchronous</a>.<br />
 1705       <tt>org.apache.logging.log4j.core.selector .BasicContextSelector</tt> - creates a single shared LoggerContext.<br />
 1706       <tt>org.apache.logging.log4j.core.selector .ClassLoaderContextSelector</tt> - separate LoggerContexts for each web application.<br />
 1707       <tt>org.apache.logging.log4j.core.selector .JndiContextSelector</tt> - use JNDI to locate each web application's LoggerContext.<br/>
 1708       <tt>org.apache.logging.log4j.core.osgi .BundleContextSelector</tt> - separate LoggerContexts for each OSGi bundle.
 1709     </td>
 1710   </tr>
 1711   <tr>
 1712     <td><a name="logEventFactory"/>log4j2.logEventFactory
 1713       <br />
 1714       (<a name="Log4jLogEventFactory"/>Log4jLogEventFactory)
 1715     </td>
 1716     <td>LOG4J_LOG_EVENT_FACTORY</td>
 1717     <!-- deliberately inserted spaces to allow line break -->
 1718     <td>org.apache.logging.log4j.core.impl .DefaultLogEventFactory</td>
 1719     <td>
 1720       Factory class used by LoggerConfig to create <tt>LogEvent</tt> instances.
 1721       (Ignored when the <tt>AsyncLoggerContextSelector</tt> is used.)
 1722     </td>
 1723   </tr>
 1724   <tr>
 1725     <td><a name="loggerContextFactory"/>log4j2.loggerContextFactory
 1726       <br />
 1727       (<a name="log4j2.loggerContextFactory"/>log4j2.loggerContextFactory)
 1728     </td>
 1729     <td>LOG4J_LOGGER_CONTEXT_FACTORY</td>
 1730     <!-- deliberately inserted spaces to allow line break -->
 1731     <td>org.apache.logging.log4j.simple .SimpleLoggerContextFactory</td>
 1732     <td>
 1733       Factory class used by LogManager to bootstrap the logging implementation.
 1734       The core jar provides <tt>org.apache.logging.log4j.core
 1735       .impl.Log4jContextFactory</tt>.
 1736     </td>
 1737   </tr>
 1738   <tr>
 1739     <td><a name="configurationFactory"/>log4j2.configurationFactory
 1740       <br />
 1741       (<a name="log4j.configurationFactory"/>log4j.configurationFactory)
 1742     </td>
 1743     <td>LOG4J_CONFIGURATION_FACTORY</td>
 1744     <td>&nbsp;</td>
 1745     <td>
 1746       Fully specified class name of a class extending <tt>org.apache.logging.log4j.core
 1747       .config.ConfigurationFactory</tt>.
 1748       If specified, an instance of this class is added to the list of configuration factories.
 1749     </td>
 1750   </tr>
 1751   <tr>
 1752     <td><a name="shutdownHookEnabled"/>log4j2.shutdownHookEnabled
 1753       <br />
 1754       (<a name="log4j.shutdownHookEnabled"/>log4j.shutdownHookEnabled)
 1755     </td>
 1756     <td>LOG4J_SHUTDOWN_HOOK_ENABLED</td>
 1757     <td>true</td>
 1758     <td>
 1759       Overrides the global flag for whether or not a shutdown hook should be used to stop a <tt>LoggerContext</tt>.
 1760       By default, this is enabled and can be disabled on a per-configuration basis. When running with the
 1761       <tt>log4j-web</tt> module, this is automatically disabled.
 1762     </td>
 1763   </tr>
 1764   <tr>
 1765     <td><a name="shutdownCallbackRegistry"/>log4j2.shutdownCallbackRegistry
 1766       <br />
 1767       (<a name="log4j.shutdownCallbackRegistry"/>log4j.shutdownCallbackRegistry)
 1768     </td>
 1769     <td>LOG4J_SHUTDOWN_CALLBACK_REGISTRY</td>
 1770     <!-- deliberately inserted spaces to allow line break -->
 1771     <td>org.apache.logging.log4j.core.util .DefaultShutdownCallbackRegistry</td>
 1772     <td>
 1773       Fully specified class name of a class implementing
 1774       <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/util/ShutdownCallbackRegistry.html">ShutdownCallbackRegistry</a>.
 1775       If specified, an instance of this class is used instead of <tt>DefaultShutdownCallbackRegistry</tt>.
 1776       The specified class must have a default constructor.
 1777     </td>
 1778   </tr>
 1779   <tr>
 1780     <td><a name="clock"/>log4j2.clock
 1781       <br />
 1782       (<a name="log4j.Clock"/>log4j.Clock)
 1783     </td>
 1784     <td>LOG4J_CLOCK</td>
 1785     <td>SystemClock</td>
 1786     <td>
 1787       Implementation of the <tt>org.apache.logging.log4j .core.util.Clock</tt>
 1788       interface that is used for timestamping the log events.
 1789       <br />
 1790       By default, <tt>System.currentTimeMillis</tt> is called on every log event.
 1791       <br />
 1792       You can also specify a fully qualified class name of a custom class that implements the
 1793       <tt>Clock</tt> interface.
 1794     </td>
 1795   </tr>
 1796   <tr>
 1797     <td><a name="enableJndiContextSelector"/>log4j2.enableJndiContextSelector</td>
 1798     <td>LOG4J_ENABLE_JNDI_CONTEXT_SELECTOR</td>
 1799     <td>false</td>
 1800     <td>
 1801       When true, the Log4j context selector that uses the JNDI java protocol is enabled. When false, the default, they are disabled.
 1802     </td>
 1803   </tr>
 1804   <tr>
 1805     <td><a name="enableJndiJdbc"/>log4j2.enableJndiJdbc</td>
 1806     <td>LOG4J_ENABLE_JNDI_JDBC</td>
 1807     <td>false</td>
 1808     <td>
 1809       When true, a Log4j JDBC Appender configured with a <code>DataSource</code> which uses JNDI's java protocol is enabled. When false, the default, they are disabled.
 1810     </td>
 1811   </tr>
 1812   <tr>
 1813     <td><a name="enableJndiJms"/>log4j2.enableJndiJms</td>
 1814     <td>LOG4J_ENABLE_JNDI_JMS</td>
 1815     <td>false</td>
 1816     <td>
 1817       When true, a Log4j JMS Appender that uses JNDI's java protocol is enabled. When false, the default, they are disabled.
 1818     </td>
 1819   </tr>
 1820   <tr>
 1821     <td><a name="enableJndiLookup"/>log4j2.enableJndiLookup</td>
 1822     <td>LOG4J_ENABLE_JNDI_LOOKUP</td>
 1823     <td>false</td>
 1824     <td>
 1825       When true, a Log4j lookup that uses JNDI's java protocol is enabled. When false, the default, they are disabled.
 1826     </td>
 1827   </tr>
 1828   <tr>
 1829     <td><a name="level"/>log4j2.level
 1830       <br />
 1831       (<a name="org.apache.logging.log4j.level"/>org.apache.logging.log4j.level)
 1832     </td>
 1833     <td>LOG4J_LEVEL</td>
 1834     <td>ERROR</td>
 1835     <td>
 1836       Log level of the default configuration. The default configuration is used if the ConfigurationFactory
 1837       could not successfully create a configuration (e.g. no log4j2.xml file was found).
 1838     </td>
 1839   </tr>
 1840   <tr>
 1841     <td><a name="disableThreadContext"/>log4j2.disableThreadContext
 1842       <br />
 1843       (disableThreadContext)
 1844     </td>
 1845     <td>LOG4J_DISABLE_THREAD_CONTEXT</td>
 1846     <td>false</td>
 1847     <td>
 1848       If <tt>true</tt>, the ThreadContext stack and map are disabled.
 1849       (May be ignored if a custom ThreadContext map is specified.)
 1850     </td>
 1851   </tr>
 1852   <tr>
 1853     <td><a name="disableThreadContextStack"/>log4j2.disableThreadContextStack
 1854       <br />
 1855       (disableThreadContextStack)
 1856     </td>
 1857     <td>LOG4J_DISABLE_THREAD_CONTEXT_STACK</td>
 1858     <td>false</td>
 1859     <td>
 1860       If <tt>true</tt>, the ThreadContext stack is disabled.
 1861     </td>
 1862   </tr>
 1863   <tr>
 1864     <td><a name="disableThreadContextMap"/>log4j2.disableThreadContextMap
 1865       <br />
 1866       (disableThreadContextMap)
 1867     </td>
 1868     <td>LOG4J_DISABLE_THREAD_CONTEXT_MAP</td>
 1869     <td>false</td>
 1870     <td>
 1871       If <tt>true</tt>, the ThreadContext map is disabled.
 1872       (May be ignored if a custom ThreadContext map is specified.)
 1873     </td>
 1874   </tr>
 1875   <tr>
 1876     <td><a name="log4j2.threadContextMap"/>log4j2.threadContextMap
 1877       <br />
 1878       (log4j2.threadContextMap)
 1879     </td>
 1880     <td>LOG4J_THREAD_CONTEXT_MAP</td>
 1881     <td>&nbsp;</td>
 1882     <td>
 1883       Fully specified class name of a custom <tt>ThreadContextMap</tt> implementation class.
 1884     </td>
 1885   </tr>
 1886   <tr>
 1887     <td><a name="isThreadContextMapInheritable"/>log4j2.isThreadContextMapInheritable
 1888       <br />
 1889       (isThreadContextMapInheritable)
 1890     </td>
 1891     <td>LOG4J_IS_THREAD_CONTEXT_MAP_INHERITABLE</td>
 1892     <td>false</td>
 1893     <td>
 1894       If <tt>true</tt> use a <tt>InheritableThreadLocal</tt> to implement the ThreadContext map.
 1895       Otherwise, use a plain <tt>ThreadLocal</tt>.
 1896       (May be ignored if a custom ThreadContext map is specified.)
 1897     </td>
 1898   </tr>
 1899   <tr>
 1900     <td><a name="contextDataInjector"/>log4j2.contextDataInjector
 1901       <br />
 1902       (<a name="log4j2.ContextDataInjector"/>log4j2.ContextDataInjector)
 1903     </td>
 1904     <td>LOG4J_CONTEXT_DATA_INJECTOR</td>
 1905     <td>&nbsp;</td>
 1906     <td>
 1907       Fully specified class name of a custom <tt>ContextDataInjector</tt> implementation class.
 1908     </td>
 1909   </tr>
 1910   <tr>
 1911     <td><a name="garbagefreeThreadContextMap"/>log4j2.garbagefreeThreadContextMap
 1912       <br />
 1913       (<a name="log4j2.garbagefree.threadContextMap"/>log4j2.garbagefree.threadContextMap)
 1914     </td>
 1915     <td>LOG4J_GARBAGEFREE_THREAD_CONTEXT_MAP</td>
 1916     <td>false</td>
 1917     <td>
 1918       Specify "true" to make the ThreadContext map garbage-free.
 1919     </td>
 1920   </tr>
 1921   <tr>
 1922     <td><a name="disableJmx"/>log4j2.disableJmx
 1923       <br />
 1924       (<a name="log4j2.disable.jmx"/>log4j2.disable.jmx)
 1925     </td>
 1926     <td>LOG4J_DISABLE_JMX</td>
 1927     <td>false</td>
 1928     <td>
 1929       If <tt>true</tt>, Log4j configuration objects like LoggerContexts, Appenders, Loggers, etc.
 1930       will not be instrumented with MBeans and cannot be remotely monitored and managed.
 1931     </td>
 1932   </tr>
 1933   <tr>
 1934     <td><a name="jmxNotifyAsync"/>log4j2.jmxNotifyAsync
 1935       <br />
 1936       (<a name="log4j2.jmx.notify.async"/>log4j2.jmx.notify.async)
 1937     </td>
 1938     <td>LOG4J_JMX_NOTIFY_ASYNC</td>
 1939     <td>false for web apps, true otherwise</td>
 1940     <td>
 1941       If <tt>true</tt>, log4j's JMX notifications are sent from a separate background thread,
 1942       otherwise they are sent from the caller thread.
 1943       If system property <tt>log4j2.is.webapp</tt> is <tt>true</tt> or the <tt>javax.servlet.Servlet</tt>
 1944       class is on the classpath, the default behaviour
 1945       is to use the caller thread to send JMX notifications.
 1946     </td>
 1947   </tr>
 1948   <tr>
 1949     <td><a name="skipJansi"/>log4j2.skipJansi
 1950       <br />
 1951       (<a name="log4j.skipJansi"/>log4j.skipJansi)
 1952     </td>
 1953     <td>LOG4J_SKIP_JANSI</td>
 1954     <td>true</td>
 1955     <td>
 1956       If <tt>true</tt>, the ConsoleAppender will not try to use the Jansi output stream on Windows.
 1957     </td>
 1958   </tr>
 1959   <tr>
 1960     <td><a name="ignoreTCL"/>log4j2.ignoreTCL
 1961       <br />
 1962       (<a name="log4j.ignoreTCL"/>log4j.ignoreTCL)
 1963     </td>
 1964     <td>LOG4J_IGNORE_TCL</td>
 1965     <td>false</td>
 1966     <td>
 1967       If <tt>true</tt>, classes are only loaded with the default class loader.
 1968       Otherwise, an attempt is made to load classes with the current thread's context class loader
 1969       before falling back to the default class loader.
 1970     </td>
 1971   </tr>
 1972   <tr>
 1973     <td><a name="uuidSequence"/>log4j2.uuidSequence
 1974       <br />
 1975       (<a name="org.apache.logging.log4j.uuidSequence"/>org.apache.logging.log4j.uuidSequence)
 1976     </td>
 1977     <td>LOG4J_UUID_SEQUENCE</td>
 1978     <td>0</td>
 1979     <td>
 1980       System property that may be used to seed the UUID generation with an integer value.
 1981     </td>
 1982   </tr>
 1983   <!--
 1984   <tr>
 1985     <td><a name="assignedSequences">log4j2.assignedSequences</td>
 1986     <td>LOG4J_ASSIGNED_SEQUENCES</td>
 1987     <td><a name="org.apache.logging.log4j.assignedSequences"/>org.apache.logging.log4j.assignedSequences</td>
 1988     <td>true</td>
 1989     <td>
 1990       TODO: used to seed UUID generation. Not sure when or why one would use this...
 1991     </td>
 1992   </tr>
 1993   -->
 1994   <tr>
 1995     <td><a name="simplelogShowContextMap"/>log4j2.simplelogShowContextMap
 1996       <br />
 1997       <!-- deliberately inserted spaces to allow line break -->
 1998       (<a name="org.apache.logging.log4j.simplelog.showContextMap"/>org.apache.logging.log4j .simplelog.showContextMap)
 1999     </td>
 2000     <td>LOG4J_SIMPLELOG_SHOW_CONTEXT_MAP</td>
 2001     <td>false</td>
 2002     <td>If <tt>true</tt>, the full ThreadContext map is included in each SimpleLogger log message.</td>
 2003   </tr>
 2004   <tr>
 2005     <td><a name="simplelogShowlogname"/>log4j2.simplelogShowlogname
 2006       <br />
 2007       <!-- deliberately inserted spaces to allow line break -->
 2008       (<a name="org.apache.logging.log4j.simplelog.showlogname"/>org.apache.logging.log4j .simplelog.showlogname)
 2009     </td>
 2010     <td>LOG4J_SIMPLELOG_SHOWLOGNAME</td>
 2011     <td>false</td>
 2012     <td>If <tt>true</tt>, the logger name is included in each SimpleLogger log message.</td>
 2013   </tr>
 2014   <tr>
 2015     <td><a name="simplelogShowShortLogname"/>log4j2.simplelogShowShortLogname
 2016       <br />
 2017       <!-- deliberately inserted spaces to allow line break -->
 2018       (<a name="org.apache.logging.log4j.simplelog.showShortLogname"/>org.apache.logging.log4j  .simplelog.showShortLogname)
 2019     </td>
 2020     <td>LOG4J_SIMPLELOG_SHOW_SHORT_LOGNAME</td>
 2021     <td>true</td>
 2022     <td>If <tt>true</tt>, only the last component of a logger name is included in SimpleLogger log messages.
 2023     (E.g., if the logger name is "mycompany.myproject.mycomponent", only "mycomponent" is logged.
 2024     </td>
 2025   </tr>
 2026   <tr>
 2027     <td><a name="simplelogShowdatetime"/>log4j2.simplelogShowdatetime
 2028       <br />
 2029       <!-- deliberately inserted spaces to allow line break -->
 2030       (<a name="org.apache.logging.log4j.simplelog.showdatetime"/>org.apache.logging.log4j .simplelog.showdatetime)
 2031     </td>
 2032     <td>LOG4J_SIMPLELOG_SHOWDATETIME</td>
 2033     <td>false</td>
 2034     <td>If <tt>true</tt>, SimpleLogger log messages contain timestamp information.
 2035     </td>
 2036   </tr>
 2037   <tr>
 2038     <td><a name="simplelogDateTimeFormat"/>log4j2.simplelogDateTimeFormat
 2039       <br />
 2040       <!-- deliberately inserted spaces to allow line break -->
 2041       (<a name="org.apache.logging.log4j.simplelog.dateTimeFormat"/>org.apache.logging.log4j .simplelog.dateTimeFormat)
 2042     </td>
 2043     <td>LOG4J_SIMPLELOG_DATE_TIME_FORMAT</td>
 2044     <td>"yyyy/MM/dd HH:mm:ss:SSS zzz"</td>
 2045     <td>Date-time format to use.
 2046     Ignored if <tt>org.apache.logging.log4j .simplelog.showdatetime</tt> is <tt>false</tt>.
 2047     </td>
 2048   </tr>
 2049   <tr>
 2050     <td><a name="simplelogLogFile"/>log4j2.simplelogLogFile
 2051       <br />
 2052       <!-- deliberately inserted spaces to allow line break -->
 2053       (<a name="org.apache.logging.log4j.simplelog.logFile"/>org.apache.logging.log4j .simplelog.logFile)
 2054     </td>
 2055     <td>LOG4J_SIMPLELOG_LOG_FILE</td>
 2056     <td>system.err</td>
 2057     <td>"system.err" (case-insensitive) logs to System.err,
 2058     "system.out" (case-insensitive) logs to System.out,
 2059     any other value is interpreted as a file name to save SimpleLogger messages to.
 2060     </td>
 2061   </tr>
 2062   <tr>
 2063     <td><a name="simplelogLevel"/>log4j2.simplelogLevel
 2064       <br />
 2065       <!-- deliberately inserted spaces to allow line break -->
 2066       (<a name="org.apache.logging.log4j.simplelog.level"/>org.apache.logging.log4j .simplelog.level)
 2067     </td>
 2068     <td>LOG4J_SIMPLELOG_LEVEL</td>
 2069     <td>ERROR</td>
 2070     <td>Default level for new SimpleLogger instances.
 2071     </td>
 2072   </tr>
 2073   <tr>
 2074     <td>log4j2.simplelog.&lt;loggerName&gt;.level
 2075       <br />
 2076       <!-- deliberately inserted spaces to allow line break -->
 2077       (<a name="org.apache.logging.log4j.simplelog.[loggerName]level"/>org.apache.logging.log4j .simplelog.&lt;loggerName&gt;.level)
 2078     </td>
 2079     <td>LOG4J_SIMPLELOG_&lt;LOGGER_NAME&gt;_LEVEL</td>
 2080     <td>SimpleLogger default log level</td>
 2081     <td>Log level for a the SimpleLogger instance with the specified name.</td>
 2082   </tr>
 2083   <tr>
 2084     <td><a name="simplelogStatusLoggerLevel"/>log4j2.simplelogStatusLoggerLevel
 2085       <br />
 2086       <!-- deliberately inserted spaces to allow line break -->
 2087       (<a name="org.apache.logging.log4j.simplelog.StatusLogger.level" />org.apache.logging.log4j.simplelog .StatusLogger.level)
 2088     </td>
 2089     <td>LOG4J_SIMPLELOG_STATUS_LOGGER_LEVEL</td>
 2090     <td>ERROR</td>
 2091     <td>This property is used to control the initial StatusLogger level, and can be overridden in code by calling
 2092     <code>StatusLogger.getLogger() .setLevel(someLevel)</code>.
 2093     Note that the StatusLogger level is only used to determine the status log output level
 2094     until a listener is registered. In practice, a listener is registered when a configuration is found,
 2095     and from that point onwards, status messages are only sent to the listeners (depending on their statusLevel).</td>
 2096   </tr>
 2097   <tr>
 2098     <td><a name="defaultStatusLevel"/>log4j2.defaultStatusLevel
 2099       <br />
 2100       (<a name="Log4jDefaultStatusLevel" />Log4jDefaultStatusLevel)
 2101     </td>
 2102     <td>LOG4J_DEFAULT_STATUS_LEVEL</td>
 2103     <td>ERROR</td>
 2104     <td>
 2105       <p>The StatusLogger logs events that occur in the logging system to the console.
 2106       During configuration, AbstractConfiguration registers a StatusConsoleListener with the StatusLogger that may
 2107       redirect status log events from the default console output to a file.
 2108       The listener also supports fine-grained filtering.
 2109       This system property specifies the default status log level for the listener to use if the configuration does not
 2110       specify a status level.
 2111       </p><p>
 2112       Note: this property is used by the log4j-core implementation only after a configuration file has been found.</p>
 2113     </td>
 2114   </tr>
 2115   <tr>
 2116     <td><a name="statusLoggerLevel"/>log4j2.statusLoggerLevel
 2117       <br />
 2118       (<a name="log4j2.StatusLogger.level"/>log4j2.StatusLogger.level)
 2119     </td>
 2120     <td>LOG4J_STATUS_LOGGER_LEVEL</td>
 2121     <td>WARN</td>
 2122     <td>
 2123       <p>The initial "listenersLevel" of the StatusLogger. If StatusLogger listeners are added, the "listenerLevel"
 2124       is changed to that of the most verbose listener. If any listeners are registered, the listenerLevel is
 2125       used to quickly determine if an interested listener exists.
 2126       </p><p>
 2127       By default, StatusLogger listeners are added when a configuration is found and by the JMX
 2128       StatusLoggerAdmin MBean. For example, if a configuration contains
 2129       <code>&lt;Configuration status="trace"&gt;</code>, a listener with statusLevel TRACE is registered
 2130       and the StatusLogger listenerLevel is set to TRACE, resulting in verbose status messages displayed on the console.
 2131       </p><p>
 2132       If no listeners are registered, the listenersLevel is not used, and the StatusLogger output level
 2133       is determined by <code>StatusLogger.getLogger().getLevel()</code>
 2134       (see property <code>org.apache.logging.log4j.simplelog .StatusLogger.level</code>).</p>
 2135     </td>
 2136   </tr>
 2137   <tr>
 2138     <td><a name="statusEntries"/>log4j2.statusEntries
 2139       <br />
 2140       (<a name="log4j2.status.entries"/>log4j2.status.entries)
 2141     </td>
 2142     <td>LOG4J_STATUS_ENTRIES</td>
 2143     <td>200</td>
 2144     <td>
 2145       Number of StatusLogger events that are kept in a buffer and can be retrieved with
 2146       <tt>StatusLogger.getStatusData()</tt>.
 2147     </td>
 2148   </tr>
 2149   <tr>
 2150     <td><a name="statusLoggerDateformat"/>log4j2.statusLoggerDateformat
 2151       <br />
 2152       (<a name="log4j2.StatusLogger.DateFormat"/>log4j2.StatusLogger.DateFormat)
 2153     </td>
 2154     <td>LOG4J_STATUS_LOGGER_DATEFORMAT</td>
 2155     <td>&nbsp;</td>
 2156     <td>
 2157       Date-time format string to use as the format for timestamps
 2158       in the status logger output. See <code>java.text.SimpleDateFormat</code> for supported formats.
 2159     </td>
 2160   </tr>
 2161   <tr>
 2162     <td><a name="asyncLoggerExceptionHandler"/>log4j2.asyncLoggerExceptionHandler
 2163       <br />
 2164       (<a name="AsyncLogger.ExceptionHandler"/>AsyncLogger.ExceptionHandler)
 2165     </td>
 2166     <td>LOG4J_ASYNC_LOGGER_EXCEPTION_HANDLER</td>
 2167     <td>default handler</td>
 2168     <td>
 2169       See <a href="async.html#SysPropsAllAsync">Async Logger System Properties</a> for details.
 2170     </td>
 2171   </tr>
 2172   <tr>
 2173     <td><a name="asyncLoggerRingBufferSize"/>log4j2.asyncLoggerRingBufferSize
 2174       <br />
 2175       (<a name="AsyncLogger.RingBufferSize"/>AsyncLogger.RingBufferSize)
 2176     </td>
 2177     <td>LOG4J_ASYNC_LOGGER_RING_BUFFER_SIZE</td>
 2178     <td>256&#160;*&#160;1024</td>
 2179     <td>
 2180       See <a href="async.html#SysPropsAllAsync">Async Logger System Properties</a> for details.
 2181     </td>
 2182   </tr>
 2183   <tr>
 2184     <td><a name="asyncLoggerWaitStrategy"/>log4j2.asyncLoggerWaitStrategy
 2185       <br />
 2186       (<a name="AsyncLogger.WaitStrategy" />AsyncLogger.WaitStrategy)
 2187     </td>
 2188     <td>LOG4J_ASYNC_LOGGER_WAIT_STRATEGY</td>
 2189     <td>
 2190       Timeout
 2191     </td>
 2192     <td>
 2193       See <a href="async.html#SysPropsAllAsync">Async Logger System Properties</a> for details.
 2194     </td>
 2195   </tr>
 2196   <tr>
 2197     <td><a name="AsyncLogger.SynchronizeEnqueueWhenQueueFull"/>AsyncLogger.SynchronizeEnqueueWhenQueueFull
 2198     </td>
 2199     <td>ASYNC_LOGGER_SYNCHRONIZE_ENQUEUE_WHEN_QUEUE_FULL</td>
 2200     <td>
 2201       true
 2202     </td>
 2203     <td>
 2204       See <a href="async.html#SysPropsAllAsync">Async Logger System Properties</a> for details.
 2205     </td>
 2206   </tr>
 2207   <tr>
 2208     <td><a name="asyncLoggerThreadNameStrategy"/>log4j2.asyncLoggerThreadNameStrategy
 2209       <br />
 2210       (<a name="AsyncLogger.ThreadNameStrategy"/>AsyncLogger.ThreadNameStrategy)
 2211     </td>
 2212     <td>LOG4J_ASYNC_LOGGER_THREAD_NAME_STRATEGY</td>
 2213     <td>
 2214       CACHED
 2215     </td>
 2216     <td>
 2217       See <a href="async.html#SysPropsAllAsync">Async Logger System Properties</a> for details.
 2218     </td>
 2219   </tr>
 2220   <tr>
 2221     <td><a name="asyncLoggerConfigExceptionHandler"/>log4j2.asyncLoggerConfigExceptionHandler
 2222       <br />
 2223       (<a name="AsyncLoggerConfig.ExceptionHandler"/>AsyncLoggerConfig.ExceptionHandler)
 2224     </td>
 2225     <td>LOG4J_ASYNC_LOGGER_CONFIG_EXCEPTION_HANDLER</td>
 2226     <td>default handler</td>
 2227     <td>
 2228       See <a href="async.html#SysPropsMixedSync-Async">Mixed Async/Synchronous Logger System Properties</a> for details.
 2229     </td>
 2230   </tr>
 2231   <tr>
 2232     <td><a name="asyncLoggerConfigRingBufferSize"/>log4j2.asyncLoggerConfigRingBufferSize
 2233       <br />
 2234       (<a name="AsyncLoggerConfig.RingBufferSize"/>AsyncLoggerConfig.RingBufferSize)
 2235     </td>
 2236     <td>LOG4J_ASYNC_LOGGER_CONFIG_RING_BUFFER_SIZE</td>
 2237     <td>256&#160;*&#160;1024</td>
 2238     <td>
 2239       See <a href="async.html#SysPropsMixedSync-Async">Mixed Async/Synchronous Logger System Properties</a> for details.
 2240     </td>
 2241   </tr>
 2242   <tr>
 2243     <td><a name="asyncLoggerConfigWaitStrategy"/>log4j2.asyncLoggerConfigWaitStrategy
 2244       <br />
 2245       (<a name="AsyncLoggerConfig.WaitStrategy"/>AsyncLoggerConfig.WaitStrategy)
 2246     </td>
 2247     <td>LOG4J_ASYNC_LOGGER_CONFIG_WAIT_STRATEGY</td>
 2248     <td>
 2249       Timeout
 2250     </td>
 2251     <td>
 2252       See <a href="async.html#SysPropsMixedSync-Async">Mixed Async/Synchronous Logger System Properties</a> for details.
 2253     </td>
 2254   </tr>
 2255   <tr>
 2256     <td><a name="AsyncLoggerConfig.SynchronizeEnqueueWhenQueueFull"/>AsyncLoggerConfig.SynchronizeEnqueueWhenQueueFull
 2257     </td>
 2258     <td>ASYNC_LOGGER_CONFIG_SYNCHRONIZE_ENQUEUE_WHEN_QUEUE_FULL</td>
 2259     <td>
 2260       true
 2261     </td>
 2262     <td>
 2263       See <a href="async.html#SysPropsMixedSync-Async">Mixed Async/Synchronous Logger System Properties</a> for details.
 2264     </td>
 2265   </tr>
 2266   <tr>
 2267     <td><a name="julLoggerAdapter"/>log4j2.julLoggerAdapter
 2268       <br />
 2269       (<a name="log4j.jul.LoggerAdapter"/>log4j.jul.LoggerAdapter)
 2270     </td>
 2271     <td>LOG4J_JUL_LOGGER_ADAPTER</td>
 2272     <!-- deliberately inserted spaces to allow line break -->
 2273     <td>org.apache.logging.log4j .jul.ApiLoggerAdapter</td>
 2274     <td>
 2275       Default LoggerAdapter to use in the JUL adapter. By default, if log4j-core is available, then the class
 2276       <code>org.apache.logging.log4j.jul .CoreLoggerAdapter</code> will be used. Otherwise, the
 2277       <code>ApiLogggerAdapter</code> will be used. Custom implementations must provide a public default constructor.
 2278     </td>
 2279   </tr>
 2280   <tr>
 2281     <td><a name="formatMsgAsync"/>log4j2.formatMsgAsync
 2282       <br />
 2283       (<a name="log4j.format.msg.async"/>log4j.format.msg.async)
 2284     </td>
 2285     <td>LOG4J_FORMAT_MSG_ASYNC</td>
 2286     <td>
 2287       false
 2288     </td>
 2289     <td>
 2290       If <tt>false</tt> (the default), Log4j will make sure the message is formatted in the caller thread, to ensure
 2291       the value at the time of the call to the logger is the value that is logged.
 2292     </td>
 2293   </tr>
 2294   <tr>
 2295     <td><a name="asyncQueueFullPolicy"/>log4j2.asyncQueueFullPolicy
 2296       <br />
 2297       (<a name="log4j2.AsyncQueueFullPolicy"/>log4j2.AsyncQueueFullPolicy)
 2298     </td>
 2299     <td>LOG4J_ASYNC_QUEUE_FULL_POLICY</td>
 2300     <td>&nbsp;</td>
 2301     <td>
 2302       <p>Used by Async Loggers and the AsyncAppender to maintain application throughput even when
 2303         the underlying appender cannot keep up with the logging rate and the queue is filling up.</p>
 2304       <p>If no value is specified (the default) events are never discarded. If the queue is full, the
 2305         logger call blocks until the event can be added to the queue.</p>
 2306       <p>Specify <tt>Discard</tt> to drop events whose level is equal or less than the threshold level
 2307         (INFO by default) when the queue is full.</p>
 2308     </td>
 2309   </tr>
 2310   <tr>
 2311     <td><a name="discardThreshold"/>log4j2.discardThreshold
 2312       <br />
 2313       (<a name="log4j2.DiscardThreshold"/>log4j2.DiscardThreshold)
 2314     </td>
 2315     <td>LOG4J_DISCARD_THRESHOLD</td>
 2316     <td>INFO</td>
 2317     <td>Used by the DiscardingAsyncQueueFullPolicy to determine which events to drop when the queue
 2318       becomes full. By default, <tt>INFO</tt>, <tt>DEBUG</tt> and <tt>TRACE</tt> level
 2319       events are discarded when the queue is full.
 2320       This property only has effect if <tt>Discard</tt> is specified as the
 2321       <tt>log4j2.AsyncQueueFullPolicy</tt>.</td>
 2322   </tr>
 2323   <tr>
 2324     <td><a name="messageFactory"/>log4j2.messageFactory
 2325       <br />
 2326       (<a name="log4j2.messageFactory" />log4j2.messageFactory)
 2327     </td>
 2328     <td>LOG4J_MESSAGE_FACTORY</td>
 2329     <td>org.apache.logging.log4j.message. ParameterizedMessageFactory or
 2330       org.apache.logging.log4j.message. ReusableMessageFactory in garbage-free mode</td>
 2331     <td>Default message factory used by Loggers if no factory was specified.</td>
 2332   </tr>
 2333   <tr>
 2334     <td><a name="flowMessageFactory"/>log4j2.flowMessageFactory
 2335       <br />
 2336       (<a name="log4j2.flowMessageFactory" />log4j2.flowMessageFactory)
 2337     </td>
 2338     <td>LOG4J_FLOW_MESSAGE_FACTORY</td>
 2339     <td>org.apache.logging.log4j.message. DefaultFlowMessageFactory</td>
 2340     <td>Default flow message factory used by Loggers.</td>
 2341   </tr>
 2342   <tr>
 2343     <td><a name="isWebapp"/>log4j2.isWebapp
 2344       <br />
 2345       (<a name="log4j2.is.webapp"/>log4j2.is.webapp)
 2346     </td>
 2347     <td>LOG4J_IS_WEBAPP</td>
 2348     <td>true if <tt>Servlet</tt> class on class path </td>
 2349     <td>This system property can be used to force Log4j 2 to behave as if it is part of a web application (when true)
 2350     or as if it is not part of a web application (when false).</td>
 2351   </tr>
 2352   <tr>
 2353     <td><a name="enableThreadlocals"/>log4j2.enableThreadlocals
 2354       <br />
 2355       (<a name="log4j2.enable.threadlocals" />log4j2.enable.threadlocals)
 2356     </td>
 2357     <td>LOG4J_ENABLE_THREADLOCALS</td>
 2358     <td>true</td>
 2359     <td>This system property can be used to switch off the use of threadlocals, which will partly disable
 2360       Log4j's garbage-free behaviour: to be fully garbage-free, Log4j stores
 2361       objects in ThreadLocal fields to reuse them, otherwise new objects are created for each log event.
 2362       Note that this property is not effective when Log4j detects it is running in a web application.</td>
 2363   </tr>
 2364   <tr>
 2365     <td><a name="enableDirectEncoders"/>log4j2.enableDirectEncoders
 2366       <br />
 2367       (<a name="log4j2.enable.direct.encoders" />log4j2.enable.direct.encoders)
 2368     </td>
 2369     <td>LOG4J_ENABLE_DIRECT_ENCODERS</td>
 2370     <td>true</td>
 2371     <td>This property can be used to force garbage-aware Layouts and Appenders to revert to the
 2372       pre-2.6 behaviour where converting log events to text generates temporary objects like
 2373       Strings and char[] arrays, and converting this text to bytes generates temporary byte[] arrays.
 2374       By default, this property is <tt>true</tt> and garbage-aware Layouts and Appenders that convert log events
 2375       to text will convert this text to bytes without creating temporary objects.</td>
 2376   </tr>
 2377   <tr>
 2378     <td><a name="initialReusableMsgSize"/>log4j2.initialReusableMsgSize
 2379       <br />
 2380       (<a name="log4j.initialReusableMsgSize" />log4j.initialReusableMsgSize)
 2381     </td>
 2382     <td>LOG4J_INITIAL_REUSABLE_MSG_SIZE</td>
 2383     <td>128</td>
 2384     <td>In GC-free mode, this property determines the initial size of the reusable StringBuilders where the message
 2385      text is formatted and potentially passed to background threads.</td>
 2386   </tr>
 2387   <tr>
 2388     <td><a name="maxReusableMsgSize"/>log4j2.maxReusableMsgSize
 2389       <br />
 2390       (<a name="log4j.maxReusableMsgSize" />log4j.maxReusableMsgSize)
 2391     </td>
 2392     <td>LOG4J_MAX_REUSABLE_MSG_SIZE</td>
 2393     <td>518</td>
 2394     <td>In GC-free mode, this property determines the maximum size of the reusable StringBuilders where the message
 2395      text is formatted and potentially passed to background threads.</td>
 2396   </tr>
 2397   <tr>
 2398     <td><a name="layoutStringBuilderMaxSize"/>log4j2.layoutStringBuilderMaxSize
 2399       <br />
 2400       (<a name="log4j.layoutStringBuilder.maxSize" />log4j.layoutStringBuilder.maxSize)
 2401     </td>
 2402     <td>LOG4J_LAYOUT_STRING_BUILDER_MAX_SIZE</td>
 2403     <td>2048</td>
 2404     <td>This property determines the maximum size of the thread-local reusable StringBuilders
 2405      used to format the log event to text by Layouts that extend AbstractStringLayout.</td>
 2406   </tr>
 2407   <tr>
 2408     <td><a name="unboxRingbufferSize"/>log4j2.unboxRingbufferSize
 2409       <br />
 2410       (<a name="log4j.unbox.ringbuffer.size" />log4j.unbox.ringbuffer.size)
 2411     </td>
 2412     <td>LOG4J_UNBOX_RINGBUFFER_SIZE</td>
 2413     <td>32</td>
 2414     <td>The <tt>org.apache.logging.log4j.util.Unbox</tt> utility
 2415     manages a small thread-local ring buffer of StringBuilders.
 2416      Each time one of the <tt>box()</tt> methods is called, the next slot in the ring buffer is used, until the ring
 2417      buffer is full and the first slot is reused. By default the Unbox ring buffer has 32 slots, so user code can
 2418      have up to 32 boxed primitives in a single logger call.
 2419      <p>
 2420      If more slots are required, set system property <tt>log4j.unbox.ringbuffer.size</tt> to the desired ring buffer size.
 2421      Note that the specified number will be rounded up to the nearest power of 2.</p></td>
 2422   </tr>
 2423   <tr>
 2424     <td><a name="loggerContextStacktraceOnStart"/>log4j2.loggerContextStacktraceOnStart
 2425       <br />
 2426       (<a name="log4j.LoggerContext.stacktrace.on.start" />log4j.LoggerContext.stacktrace.on.start)
 2427     </td>
 2428     <td>LOG4J_LOGGER_CONTEXT_STACKTRACE_ON_START</td>
 2429     <td>false</td>
 2430     <td>Prints a stacktrace to the <a href="#StatusMessages">status logger</a> at DEBUG level
 2431     when the LoggerContext is started. For debug purposes.</td>
 2432   </tr>
 2433   <tr>
 2434       <td><a name="formatMsgNoLookups"/>log4j2.formatMsgNoLookups
 2435         <br />
 2436         (<a name="log4j2.formatMsgNoLookups" />log4j2.formatMsgNoLookups)
 2437       </td>
 2438       <td>FORMAT_MESSAGES_PATTERN_DISABLE_LOOKUPS</td>
 2439       <td>false</td>
 2440       <td>Disables message pattern lookups globally when set to <tt>true</tt>.
 2441           This is equivalent to defining all message patterns using <tt>%m{nolookups}</tt>.</td>
 2442   </tr>
 2443   <tr>
 2444     <td><a name="log4j2.trustStoreLocation "/>log4j2.trustStoreLocation</td>
 2445     <td>LOG4J_TRUST_STORE_LOCATION</td>
 2446     <td></td>
 2447     <td>The location of the trust store. If not provided the default trust store will be used.</td>
 2448   </tr>
 2449   <tr>
 2450     <td><a name="log4j2.trustStorePassword"/>log4j2.trustStorePassword</td>
 2451     <td>LOG4J_TRUST_STORE_PASSWORD</td>
 2452     <td></td>
 2453     <td>Password needed to access the trust store.</td>
 2454   </tr>
 2455   <tr>
 2456     <td><a name="log4j2.trustStorePasswordFile"/>log4j2.trustStorePasswordFile</td>
 2457     <td>LOG4J_TRUST_STORE_PASSWORD_FILE</td>
 2458     <td></td>
 2459     <td>The location of a file that contains the password for the trust store.</td>
 2460   </tr>
 2461   <tr>
 2462     <td><a name="log4j2.trustStorePasswordEnvironmentVariable"/>log4j2.trustStorePasswordEnvironmentVariable</td>
 2463     <td>LOG4J_TRUST_STORE_PASSWORD_ENVIRONMENT_VARIABLE</td>
 2464     <td></td>
 2465     <td>The name of the environment variable that contains the trust store password.</td>
 2466   </tr>
 2467   <tr>
 2468     <td><a name="log4j2.trustStoreType"/>log4j2.trustStoreType</td>
 2469     <td>LOG4J_TRUST_STORE_TYPE</td>
 2470     <td></td>
 2471     <td>The type of key store used for the trust store.</td>
 2472   </tr>
 2473   <tr>
 2474     <td><a name="log4j2.trustStoreKeyManagerFactoryAlgorithm"/>log4j2.trustStoreKeyManagerFactoryAlgorithm</td>
 2475     <td>LOG4J_TRUST_STORE_KEY_MANAGER_FACTORY_ALGORITHM</td>
 2476     <td></td>
 2477     <td>Java cryptographic algorithm.</td>
 2478   </tr>
 2479   <tr>
 2480     <td><a name="log4j2.keyStoreLocation "/>log4j2.keyStoreLocation </td>
 2481     <td>LOG4J_KEY_STORE_LOCATION</td>
 2482     <td></td>
 2483     <td>The location of the key store. If not provided the default key store will be used.</td>
 2484   </tr>
 2485   <tr>
 2486     <td><a name="log4j2.keyStorePassword"/>log4j2.keyStorePassword</td>
 2487     <td>LOG4J_KEY_STORE_PASSWORD</td>
 2488     <td></td>
 2489     <td>Password needed to access the key store.</td>
 2490   </tr>
 2491   <tr>
 2492     <td><a name="log4j2.keyStorePasswordFile"/>log4j2.keyStorePasswordFile</td>
 2493     <td>LOG4J_KEY_STORE_PASSWORD_FILE</td>
 2494     <td></td>
 2495     <td>The location of a file that contains the password for the key store.</td>
 2496   </tr>
 2497   <tr>
 2498     <td><a name="log4j2.keyStorePasswordEnvironmentVariable"/>log4j2.keyStorePasswordEnvironmentVariable</td>
 2499     <td>LOG4J_KEY_STORE_PASSWORD_ENVIRONMENT_VARIABLE</td>
 2500     <td></td>
 2501     <td>The name of the environment variable that contains the key store password.</td>
 2502   </tr>
 2503   <tr>
 2504     <td><a name="log4j2.keyStoreType"/>log4j2.keyStoreType</td>
 2505     <td>LOG4J_KEY_STORE_TYPE</td>
 2506     <td></td>t
 2507     <td>The type of key store.</td>
 2508   </tr>
 2509   <tr>
 2510     <td><a name="log4j2.keyStoreKeyManagerFactoryAlgorithm"/>log4j2.keyStoreKeyManagerFactoryAlgorithm</td>
 2511     <td>LOG4J_KEY_STORE_KEY_MANAGER_FACTORY_ALGORITHM</td>
 2512     <td></td>
 2513     <td>Java cryptographic algorithm.</td>
 2514   </tr>
 2515   <tr>
 2516     <td><a name="log4j2.sslVerifyHostName"/>log4j2.sslVerifyHostName</td>
 2517     <td></td>
 2518     <td>false</td>
 2519     <td>true or false if the host name should be verified</td>
 2520   </tr>
 2521 </table>
 2522 
 2523         </subsection>
 2524       </section>
 2525     </body>
 2526 </document>