logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1201395 - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers: log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/ log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/ log4j2-core/src/main/jav...
Date Sun, 13 Nov 2011 02:28:24 GMT
Author: rgoers
Date: Sun Nov 13 02:28:23 2011
New Revision: 1201395

URL: http://svn.apache.org/viewvc?rev=1201395&view=rev
Log:
Added Layout documentation. Added tests to verify layouts. Added UUIDPatternConverter

Added:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/package-info.java
      - copied, changed from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/package-info.java
      - copied, changed from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/UUIDUtil.java
      - copied, changed from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/UUIDPatternConverter.java
      - copied, changed from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/NameAbbreviatorTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/extending.xml
Removed:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java
Modified:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeEvent.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/flume/UUIDTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/site.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/layouts.xml

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeEvent.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeEvent.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeEvent.java Sun Nov 13 02:28:23 2011
@@ -21,6 +21,7 @@ import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LoggingException;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.helpers.UUIDUtil;
 import org.apache.logging.log4j.message.MapMessage;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.StructuredDataId;

Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/package-info.java (from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/package-info.java?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/package-info.java&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java&r1=1195339&r2=1201395&rev=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/package-info.java Sun Nov 13 02:28:23 2011
@@ -17,4 +17,4 @@
 /**
  * Apache Flume Appender. Requires the user specifically include Flume and its dependencies.
  */
-package org.apache.logging.log4j.core.appender.flume;
+package org.apache.logging.log4j.core.appender.rewrite;

Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/package-info.java (from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/package-info.java?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/package-info.java&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java&r1=1195339&r2=1201395&rev=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/package-info.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/package-info.java Sun Nov 13 02:28:23 2011
@@ -17,4 +17,4 @@
 /**
  * Apache Flume Appender. Requires the user specifically include Flume and its dependencies.
  */
-package org.apache.logging.log4j.core.appender.flume;
+package org.apache.logging.log4j.core.appender.routing;

Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/UUIDUtil.java (from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/UUIDUtil.java?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/UUIDUtil.java&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java&r1=1195339&r2=1201395&rev=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/UUIDUtil.java Sun Nov 13 02:28:23 2011
@@ -14,7 +14,7 @@
  * See the license for the specific language governing permissions and
  * limitations under the license.
  */
-package org.apache.logging.log4j.core.appender.flume;
+package org.apache.logging.log4j.core.helpers;
 
 import org.apache.commons.lang.StringUtils;
 
@@ -48,7 +48,7 @@ public abstract class UUIDUtil
 
     private static final int SEQUENCE_MASK = 0x3FFF;
 
-    static final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L;
+    public static final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L;
 
     private static long uuidSequence = Long.getLong(UUID_SEQUENCE, 0);
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java Sun Nov 13 02:28:23 2011
@@ -43,353 +43,8 @@ import java.util.List;
  * pattern of the printf function in C. A conversion pattern is
  * composed of literal text and format control expressions called
  * <em>conversion specifiers</em>.
- * <p/>
- * <p><i>Note that you are free to insert any literal text within the
- * conversion pattern.</i>
- * </p>
- * <p/>
- * <p>Each conversion specifier starts with a percent sign (%) and is
- * followed by optional <em>format modifiers</em> and a <em>conversion
- * character</em>. The conversion character specifies the type of
- * data, e.g. category, priority, date, thread name. The format
- * modifiers control such things as field width, padding, left and
- * right justification. The following is a simple example.
- * <p/>
- * <p>Let the conversion pattern be <b>"%-5p [%t]: %m%n"</b> and assume
- * that the log4j environment was set to use a PatternLayout. Then the
- * statements
- * <pre>
- * Logger logger = LoggerFactory().getLogger("MyLogger");
- * logger.debug("Message 1");
- * logger.warn("Message 2");
- * </pre>
- * would yield the output
- * <pre>
- * DEBUG [main]: Message 1
- * WARN  [main]: Message 2
- * </pre>
- * <p/>
- * <p>Note that there is no explicit separator between text and
- * conversion specifiers. The pattern parser knows when it has reached
- * the end of a conversion specifier when it reads a conversion
- * character. In the example above the conversion specifier
- * <b>%-5p</b> means the priority of the logging event should be left
- * justified to a width of five characters.
- * <p/>
- * The recognized conversion characters are
- * <p/>
- * <p>
- * <table border="1" CELLPADDING="8">
- * <th>Conversion Character</th>
- * <th>Effect</th>
- * <p/>
- * <tr>
- * <td align=center><b>c</b></td>
- * <p/>
- * <td>Used to output the category of the logging event. The
- * category conversion specifier can be optionally followed by
- * <em>precision specifier</em>, that is a decimal constant in
- * brackets.
- * <p/>
- * <p>If a precision specifier is given, then only the corresponding
- * number of right most components of the category name will be
- * printed. By default the category name is printed in full.
- * <p/>
- * <p>For example, for the category name "a.b.c" the pattern
- * <b>%c{2}</b> will output "b.c".
- * <p/>
- * </td>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>C</b></td>
- * <p/>
- * <td>Used to output the fully qualified class name of the caller
- * issuing the logging request. This conversion specifier
- * can be optionally followed by <em>precision specifier</em>, that
- * is a decimal constant in brackets.
- * <p/>
- * <p>If a precision specifier is given, then only the corresponding
- * number of right most components of the class name will be
- * printed. By default the class name is output in fully qualified form.
- * <p/>
- * <p>For example, for the class name "org.apache.xyz.SomeClass", the
- * pattern <b>%C{1}</b> will output "SomeClass".
- * <p/>
- * <p><b>WARNING</b> Generating the caller class information is
- * slow. Thus, it's use should be avoided unless execution speed is
- * not an issue.
- * <p/>
- * </td>
- * </tr>
- * <p/>
- * <tr> <td align=center><b>d</b></td> <td>Used to output the date of
- * the logging event. The date conversion specifier may be
- * followed by a set of braces containing a
- * date and time pattern strings {@link java.text.SimpleDateFormat},
- * <em>ABSOLUTE</em>, <em>DATE</em> or <em>ISO8601</em>
- * and a set of braces containing a time zone id per
- * {@link java.util.TimeZone#getTimeZone(String)}.
- * For example, <b>%d{HH:mm:ss,SSS}</b>,
- * <b>%d{dd&nbsp;MMM&nbsp;yyyy&nbsp;HH:mm:ss,SSS}</b>,
- * <b>%d{DATE}</b> or <b>%d{HH:mm:ss}{GMT+0}</b>. If no date format specifier is given then
- * ISO8601 format is assumed.
- * </td>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>F</b></td>
- * <p/>
- * <td>Used to output the file name where the logging request was
- * issued.
- * <p/>
- * <p><b>WARNING</b> Generating caller location information is
- * extremely slow. Its use should be avoided unless execution speed
- * is not an issue.
- * <p/>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>l</b></td>
- * <p/>
- * <td>Used to output location information of the caller which generated
- * the logging event.
- * <p/>
- * <p>The location information depends on the JVM implementation but
- * usually consists of the fully qualified name of the calling
- * method followed by the callers source the file name and line
- * number between parentheses.
- * <p/>
- * </td>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>L</b></td>
- * <p/>
- * <td>Used to output the line number from where the logging request
- * was issued.
- * <p/>
- * </tr>
- * <p/>
- * <p/>
- * <tr>
- * <td align=center><b>m</b></td>
- * <td>Used to output the application supplied message associated with
- * the logging event.</td>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>M</b></td>
- * <p/>
- * <td>Used to output the method name where the logging request was
- * issued.
- * <p/>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>n</b></td>
- * <p/>
- * <td>Outputs the platform dependent line separator character or
- * characters.
- * <p/>
- * <p>This conversion character offers practically the same
- * performance as using non-portable line separator strings such as
- * "\n", or "\r\n". Thus, it is the preferred way of specifying a
- * line separator.
- * <p/>
- * <p/>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>p</b></td>
- * <td>Used to output the level of the logging event.</td>
- * </tr>
- * <p/>
- * <tr>
- * <p/>
- * <td align=center><b>r</b></td>
- * <p/>
- * <td>Used to output the number of milliseconds elapsed since the construction
- * of the layout until the creation of the logging event.</td>
- * </tr>
- * <p/>
- * <p/>
- * <tr>
- * <td align=center><b>t</b></td>
- * <p/>
- * <td>Used to output the name of the thread that generated the logging event.</td>
- * <p/>
- * </tr>
- * <p/>
- * <tr>
- * <p/>
- * <td align=center><b>x</b></td>
- * <p/>
- * <td>Used to output the NDC (nested diagnostic context) associated
- * with the thread that generated the logging event.
- * </td>
- * </tr>
- * <p/>
- * <p/>
- * <tr>
- * <td align=center><b>X</b></td>
- * <p/>
- * <td>
- * <p/>
- * <p>Used to output the MDC (mapped diagnostic context) associated
- * with the thread that generated the logging event. The <b>X</b>
- * conversion character can be followed by the key for the
- * map placed between braces, as in <b>%X{clientNumber}</b> where
- * <code>clientNumber</code> is the key. The value in the MDC
- * corresponding to the key will be output. If no additional sub-option
- * is specified, then the entire contents of the MDC key value pair set
- * is output using a format {{key1,val1},{key2,val2}}</p>
- * <p/>
- * <p>See {@link ThreadContext} class for more details.
- * </p>
- * <p/>
- * </td>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>properties</b></td>
- * <p/>
- * <td>
- * <p>Used to output the Properties associated with the logging event. The <b>properties</b>
- * conversion word can be followed by the key for the
- * map placed between braces, as in <b>%properties{application}</b> where
- * <code>application</code> is the key. The value in the Properties bundle
- * corresponding to the key will be output. If no additional sub-option
- * is specified, then the entire contents of the Properties key value pair set
- * is output using a format {{key1,val1},{key2,val2}}</p>
- * </td>
- * </tr>
- * <p/>
- * <tr>
- * <td align=center><b>throwable</b></td>
- * <p/>
- * <td>
- * <p>Used to output the Throwable trace that has been bound to the LoggingEvent, by
- * default this will output the full trace as one would normally find by a call to Throwable.printStackTrace().
- * The throwable conversion word can be followed by an option in the form <b>%throwable{short}</b>
- * which will only output the first line of the Throwable.</p>
- * </td>
- * </tr>
- * <p/>
- * <tr>
- * <p/>
- * <td align=center><b>%</b></td>
- * <p/>
- * <td>The sequence %% outputs a single percent sign.
- * </td>
- * </tr>
- * <p/>
- * </table>
- * <p/>
- * <p>By default the relevant information is output as is. However,
- * with the aid of format modifiers it is possible to change the
- * minimum field width, the maximum field width and justification.
- * <p/>
- * <p>The optional format modifier is placed between the percent sign
- * and the conversion character.
- * <p/>
- * <p>The first optional format modifier is the <em>left justification
- * flag</em> which is just the minus (-) character. Then comes the
- * optional <em>minimum field width</em> modifier. This is a decimal
- * constant that represents the minimum number of characters to
- * output. If the data item requires fewer characters, it is padded on
- * either the left or the right until the minimum width is
- * reached. The default is to pad on the left (right justify) but you
- * can specify right padding with the left justification flag. The
- * padding character is space. If the data item is larger than the
- * minimum field width, the field is expanded to accommodate the
- * data. The value is never truncated.
- * <p/>
- * <p>This behavior can be changed using the <em>maximum field
- * width</em> modifier which is designated by a period followed by a
- * decimal constant. If the data item is longer than the maximum
- * field, then the extra characters are removed from the
- * <em>beginning</em> of the data item and not from the end. For
- * example, it the maximum field width is eight and the data item is
- * ten characters long, then the first two characters of the data item
- * are dropped. This behavior deviates from the printf function in C
- * where truncation is done from the end.
- * <p/>
- * <p>Below are various format modifier examples for the category
- * conversion specifier.
- * <p/>
- * <p/>
- * <TABLE BORDER=1 CELLPADDING=8>
- * <th>Format modifier
- * <th>left justify
- * <th>minimum width
- * <th>maximum width
- * <th>comment
- * <p/>
- * <tr>
- * <td align=center>%20c</td>
- * <td align=center>false</td>
- * <td align=center>20</td>
- * <td align=center>none</td>
- * <p/>
- * <td>Left pad with spaces if the category name is less than 20
- * characters long.
- * <p/>
- * <tr> <td align=center>%-20c</td> <td align=center>true</td> <td
- * align=center>20</td> <td align=center>none</td> <td>Right pad with
- * spaces if the category name is less than 20 characters long.
- * <p/>
- * <tr>
- * <td align=center>%.30c</td>
- * <td align=center>NA</td>
- * <td align=center>none</td>
- * <td align=center>30</td>
- * <p/>
- * <td>Truncate from the beginning if the category name is longer than 30
- * characters.
- * <p/>
- * <tr>
- * <td align=center>%20.30c</td>
- * <td align=center>false</td>
- * <td align=center>20</td>
- * <td align=center>30</td>
- * <p/>
- * <td>Left pad with spaces if the category name is shorter than 20
- * characters. However, if category name is longer than 30 characters,
- * then truncate from the beginning.
- * <p/>
- * <tr>
- * <td align=center>%-20.30c</td>
- * <td align=center>true</td>
- * <td align=center>20</td>
- * <td align=center>30</td>
- * <p/>
- * <td>Right pad with spaces if the category name is shorter than 20
- * characters. However, if category name is longer than 30 characters,
- * then truncate from the beginning.
- * <p/>
- * </table>
- * <p/>
- * <p>Below are some examples of conversion patterns.
- * <p/>
- * <dl>
- * <p/>
- * <p><dt><b>%r [%t] %-5p %c %x - %m%n</b>
- * <p><dd>This is essentially the TTCC layout.
- * <p/>
- * <p><dt><b>%-6r [%15.15t] %-5p %30.30c %x - %m%n</b>
- * <p/>
- * <p><dd>Similar to the TTCC layout except that the relative time is
- * right padded if less than 6 digits, thread name is right padded if
- * less than 15 characters and truncated if longer and the category
- * name is left padded if shorter than 30 characters and truncated if
- * longer.
- * <p/>
- * </dl>
- * <p/>
- * <p>The above text is largely inspired from Peter A. Darnell and
- * Philip E. Margolis' highly recommended book "C -- a Software
- * Engineering Approach", ISBN 0-387-97389-3.
+ *
+ * See the Log4j Manual for details on the supported pattern converters.
  */
 @Plugin(name="PatternLayout",type="Core",elementType="layout",printObject=true)
 public class PatternLayout extends AbstractStringLayout {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java Sun Nov 13 02:28:23 2011
@@ -49,7 +49,7 @@ import org.apache.logging.log4j.core.Log
  *
  * &lt;!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd" [&lt;!ENTITY data SYSTEM "abc"&gt;]&gt;
  *
- * &lt;log4j:eventSet version="1.2" xmlns:log4j="http://jakarta.apache.org/log4j/"&gt;
+ * &lt;log4j:eventSet version="1.2" xmlns:log4j="http://logging.apache.org/log4j/"&gt;
  * &nbsp;&nbsp;&data;
  * &lt;/log4j:eventSet&gt;
  * </pre>
@@ -169,7 +169,7 @@ public class XMLLayout extends AbstractS
         }
         StringBuilder sbuf = new StringBuilder();
         sbuf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
-        sbuf.append("<log4j:eventSet xmlns:log4j=\"http://jakarta.apache.org/log4j/\">\r\n");
+        sbuf.append("<log4j:eventSet xmlns:log4j=\"http://logging.apache.org/log4j/\">\r\n");
         return sbuf.toString().getBytes(getCharset());
     }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java Sun Nov 13 02:28:23 2011
@@ -164,7 +164,7 @@ public abstract class NameAbbreviator {
          * @param count maximum number of path elements to output.
          */
         public MaxElementAbbreviator(final int count) {
-            this.count = count;
+            this.count = count < 1 ? 1 : count;
         }
 
         /**

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java Sun Nov 13 02:28:23 2011
@@ -20,6 +20,8 @@ package org.apache.logging.log4j.core.pa
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 
+import java.util.concurrent.atomic.AtomicLong;
+
 
 /**
  * Formats the event sequence number.
@@ -27,6 +29,7 @@ import org.apache.logging.log4j.core.con
 @Plugin(name="SequenceNumberPatternConverter", type="Converter")
 @ConverterKeys({"sn", "sequenceNumber"})
 public class SequenceNumberPatternConverter extends LogEventPatternConverter {
+    private static AtomicLong sequence = new AtomicLong();
     /**
      * Singleton.
      */
@@ -55,6 +58,6 @@ public class SequenceNumberPatternConver
      * {@inheritDoc}
      */
     public void format(final LogEvent event, final StringBuilder toAppendTo) {
-        toAppendTo.append("0");
+        toAppendTo.append(Long.toString(sequence.incrementAndGet()));
     }
 }

Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/UUIDPatternConverter.java (from r1195339, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/UUIDPatternConverter.java?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/UUIDPatternConverter.java&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java&r1=1195339&r2=1201395&rev=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/pattern/UUIDPatternConverter.java Sun Nov 13 02:28:23 2011
@@ -17,27 +17,32 @@
 
 package org.apache.logging.log4j.core.pattern;
 
+import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.helpers.UUIDUtil;
+import org.apache.logging.log4j.status.StatusLogger;
+
+import java.util.UUID;
 
 
 /**
  * Formats the event sequence number.
  */
-@Plugin(name="SequenceNumberPatternConverter", type="Converter")
-@ConverterKeys({"sn", "sequenceNumber"})
-public class SequenceNumberPatternConverter extends LogEventPatternConverter {
-    /**
-     * Singleton.
-     */
-    private static final SequenceNumberPatternConverter INSTANCE =
-        new SequenceNumberPatternConverter();
+@Plugin(name="UUIDPatternConverter", type="Converter")
+@ConverterKeys({"u", "uuid"})
+public class UUIDPatternConverter extends LogEventPatternConverter {
+
+    private final boolean isRandom;
+
+    private static Logger logger = StatusLogger.getLogger();
 
     /**
      * Private constructor.
      */
-    private SequenceNumberPatternConverter() {
-        super("Sequence Number", "sn");
+    private UUIDPatternConverter(boolean isRandom) {
+        super("u", "uuid");
+        this.isRandom = isRandom;
     }
 
     /**
@@ -46,15 +51,22 @@ public class SequenceNumberPatternConver
      * @param options options, currently ignored, may be null.
      * @return instance of SequencePatternConverter.
      */
-    public static SequenceNumberPatternConverter newInstance(
-        final String[] options) {
-        return INSTANCE;
+    public static UUIDPatternConverter newInstance(final String[] options) {
+        if (options.length == 0) {
+            return new UUIDPatternConverter(false);
+        }
+
+        if (options.length > 1 || (!options[0].equalsIgnoreCase("RANDOM") && !options[0].equalsIgnoreCase("Time"))) {
+            logger.error("UUID Pattern Converter only accepts a single option with the value \"RANDOM\" or \"TIME\"");
+        }
+        return new UUIDPatternConverter(options[0].equalsIgnoreCase("RANDOM"));
     }
 
     /**
      * {@inheritDoc}
      */
     public void format(final LogEvent event, final StringBuilder toAppendTo) {
-        toAppendTo.append("0");
+        UUID uuid = isRandom ? UUID.randomUUID() : UUIDUtil.getTimeBasedUUID();
+        toAppendTo.append(uuid.toString());
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/flume/UUIDTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/flume/UUIDTest.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/flume/UUIDTest.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/flume/UUIDTest.java Sun Nov 13 02:28:23 2011
@@ -1,5 +1,6 @@
 package org.apache.logging.log4j.core.appender.flume;
 
+import org.apache.logging.log4j.core.helpers.UUIDUtil;
 import org.junit.Test;
 
 import java.util.UUID;

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java Sun Nov 13 02:28:23 2011
@@ -19,15 +19,16 @@ package org.apache.logging.log4j.core.la
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.Lifecycle;
+import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.Logger;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.BasicConfigurationFactory;
 import org.apache.logging.log4j.core.appender.FileAppender;
 import org.apache.logging.log4j.core.appender.FileManager;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
 import org.apache.logging.log4j.core.util.Compare;
+import org.apache.logging.log4j.message.SimpleMessage;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -35,6 +36,7 @@ import org.junit.Test;
 import java.io.FileOutputStream;
 
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 
 /**
  *
@@ -46,6 +48,7 @@ public class PatternLayoutTest {
     Logger root = ctx.getLogger("");
 
     static String msgPattern = "%m%n";
+    static final String regexPattern = "%replace{%logger %msg}{\\.}{/}";
     static ConfigurationFactory cf = new BasicConfigurationFactory();
 
     @BeforeClass
@@ -132,4 +135,15 @@ public class PatternLayoutTest {
 
         appender.stop();
     }
+
+    @Test
+    public void testRegex() throws Exception {
+        LoggerContext ctx = (LoggerContext) LogManager.getContext();
+        PatternLayout layout = PatternLayout.createLayout(regexPattern, ctx.getConfiguration(),
+            null, null);
+        LogEvent event = new Log4jLogEvent(this.getClass().getName(), null, "org.apache.logging.log4j.core.Logger",
+            Level.INFO, new SimpleMessage("Hello, world!"), null);
+        byte[] result = layout.format(event);
+        assertEquals("org/apache/logging/log4j/core/layout/PatternLayoutTest Hello, world!", new String(result));
+    }
 }

Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/NameAbbreviatorTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/NameAbbreviatorTest.java?rev=1201395&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/NameAbbreviatorTest.java (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/NameAbbreviatorTest.java Sun Nov 13 02:28:23 2011
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.pattern;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ *
+ */
+public class NameAbbreviatorTest {
+
+    @Test
+    public void testZero() {
+        String str = this.getClass().getName();
+        NameAbbreviator a = NameAbbreviator.getAbbreviator("0");
+        String result = a.abbreviate(str);
+        assertEquals("NameAbbreviatorTest", result);
+    }
+
+    @Test
+    public void testNameAbbreviation() {
+        String str = this.getClass().getName();
+        NameAbbreviator a = NameAbbreviator.getAbbreviator("1");
+        String result = a.abbreviate(str);
+        assertEquals("NameAbbreviatorTest", result);
+    }
+
+     @Test
+    public void testTwo() {
+        String str = this.getClass().getName();
+        NameAbbreviator a = NameAbbreviator.getAbbreviator("2");
+        String result = a.abbreviate(str);
+        assertEquals("pattern.NameAbbreviatorTest", result);
+
+    }
+
+    @Test
+    public void testShortName() {
+        String str = this.getClass().getName();
+        NameAbbreviator a = NameAbbreviator.getAbbreviator("1.");
+        String result = a.abbreviate(str);
+        assertEquals("o.a.l.l.c.p.NameAbbreviatorTest", result);
+
+    }
+
+    @Test
+    public void testSkipNames() {
+        String str = this.getClass().getName();
+        NameAbbreviator a = NameAbbreviator.getAbbreviator("1.1.~");
+        String result = a.abbreviate(str);
+        assertEquals("o.a.~.~.~.~.NameAbbreviatorTest", result);
+
+    }
+
+     @Test
+    public void testZeroDot() {
+        String str = this.getClass().getName();
+        NameAbbreviator a = NameAbbreviator.getAbbreviator(".");
+        String result = a.abbreviate(str);
+        assertEquals("......NameAbbreviatorTest", result);
+
+    }
+}

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/site.xml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/site.xml?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/site.xml (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/site.xml Sun Nov 13 02:28:23 2011
@@ -81,6 +81,18 @@
         <item name="ThreadContext"         href="/manual/thread-context.html"/>
         <item name="JMX"                   href="/manual/jmx.html"/>
         <item name="Logging Separation"    href="/manual/logsep.html"/>
+        <item name="Extending Log4j"       href="/manual/extending.html" collapse="true">
+          <item name="LoggerContextFactory" href="/manual/extending.html#LoggerContextFactory"/>
+          <item name="ContextSelector"     href="/manual/extending.html#ContextSelector"/>
+          <item name="ConfigurationFactory" href="/manual/extending.html#ConfigurationFactory"/>
+          <item name="LoggerConfig"        href="/manual/extending.html#LoggerConfig"/>
+          <item name="Lookups"             href="/manual/extending.html#Lookups"/>
+          <item name="Filters"             href="/manual/extending.html#Filters"/>
+          <item name="Appenders"           href="/manual/extending.html#Appenders"/>
+          <item name="Layouts"             href="/manual/extending.html#Layouts"/>
+          <item name="PatternConverters"   href="/manual/extending.html#PatternConverters"/>
+          <item name="Custom Plugins"      href="/manual/extending.html#Custom"/>
+        </item>
       </item>
       <item name="Wiki"                    href="http://wiki.apache.org/logging"/>
     </menu>

Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/extending.xml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/extending.xml?rev=1201395&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/extending.xml (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/extending.xml Sun Nov 13 02:28:23 2011
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<document>
+    <properties>
+        <title>Extending Log4j</title>
+        <author email="rgoers@apache.org">Ralph Goers</author>
+    </properties>
+
+    <body>
+      <section name="Extending Log4j">
+          <subsection name="LoggerContextFactory">
+
+          </subsection>
+          <subsection name="ContextSelector">
+
+          </subsection>
+          <subsection name="ConfigurationFactory">
+
+          </subsection>
+          <subsection name="LoggerConfig">
+
+          </subsection>
+          <subsection name="Lookups">
+
+          </subsection>
+          <subsection name="Filters">
+
+          </subsection>
+          <subsection name="Appenders">
+
+          </subsection>
+          <subsection name="Layouts">
+
+          </subsection>
+          <subsection name="PatternConverters">
+
+          </subsection>
+          <subsection name="Custom Plugins">
+
+          </subsection>
+      </section>
+
+    </body>
+</document>
\ No newline at end of file

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/layouts.xml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/layouts.xml?rev=1201395&r1=1201394&r2=1201395&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/layouts.xml (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/src/site/xdoc/manual/layouts.xml Sun Nov 13 02:28:23 2011
@@ -18,34 +18,730 @@
 
 <document>
     <properties>
-        <title>Overview</title>
+        <title>Log4j Layouts</title>
         <author email="rgoers@apache.org">Ralph Goers</author>
     </properties>
 
     <body>
       <section name="Layouts">
+        <p>
+          Layouts are used by Appenders to format the LogEvent into a form that meets the needs of whoever will be
+          consuming the log events. In Log4j 1.x and Logback Layouts were expected to transform an event into a
+          String. In Log4j 2.0 Layouts return a byte array. This allows the result of the Layout to be useful in
+          many more types of Appenders. However, this means most Layouts need to be configured with a
+          <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Charset</a> to
+          insure the byte array contains correct values.
+        </p>
         <a name="HTMLLayout"/>
         <subsection name="HTMLLayout">
-
+          <table border="1" width="100%">
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>charset</td>
+              <td>String</td>
+              <td>The character set to use when converting the HTML String to a byte array. The value must be
+                a valid <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Charset</a>.
+                If not specified, the default system Charset will be used.</td>
+            </tr>
+            <tr>
+              <td>contentType</td>
+              <td>String</td>
+              <td>The value to assign to the Content-Type header. The default is "text/html".</td>
+            </tr>
+            <tr>
+              <td>locationInfo</td>
+              <td>boolean</td>
+              <td>If true, the filename and line number will be included in the HTML output. The default value is
+                false.</td>
+            </tr>
+            <tr>
+              <td>title</td>
+              <td>String</td>
+              <td>A String that will appear as the HTML title.</td>
+            </tr>
+            <caption align="top">HTML Layout Parameters</caption>
+          </table>
         </subsection>
         <a name="PatternLayout"/>
         <subsection name="PatternLayout">
+          <p>
+            A flexible layout configurable with pattern string. The goal of this class is to format a LogEvent and
+            return the results. The format of the result depends on the <em>conversion pattern</em>.
+          </p>
+          <p>
+            The conversion pattern is closely related to the conversion pattern of the printf function in C.
+            A conversion pattern is composed of literal text and format control expressions called
+            <em>conversion specifiers</em>.
+          </p>
+          <p>
+            <i>Note that any literal text may be included in the conversion pattern.</i>
+          </p>
+          <p>
+            Each conversion specifier starts with a percent sign (%) and is followed by optional <em>format
+            modifiers</em> and a <em>conversion character</em>. The conversion character specifies the type of
+            data, e.g. category, priority, date, thread name. The format modifiers control such things as field width,
+            padding, left and right justification. The following is a simple example.
+          </p>
+          <p>
+            Let the conversion pattern be <b>"%-5p [%t]: %m%n"</b> and assume that the log4j environment was set to
+            use a PatternLayout. Then the statements
+ <pre>
+ Logger logger = LogManager.getLogger("MyLogger");
+ logger.debug("Message 1");
+ logger.warn("Message 2");
+ </pre>
+            would yield the output
+ <pre>
+ DEBUG [main]: Message 1
+ WARN  [main]: Message 2
+ </pre>
+          </p>
+          <p>
+            Note that there is no explicit separator between text and conversion specifiers. The pattern parser
+            knows when it has reached the end of a conversion specifier when it reads a conversion character.
+            In the example above the conversion specifier <b>%-5p</b> means the priority of the logging event should
+            be left justified to a width of five characters.
+          </p>
 
+          <table border="1" width="100%">
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>charset</td>
+              <td>String</td>
+              <td>The character set to use when converting the syslog String to a byte array. The String must be
+                a valid<a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Charset</a>.
+                If not specified, the default system Charset will be used.
+              </td>
+            </tr>
+            <tr>
+              <td>pattern</td>
+              <td>String</td>
+              <td></td>
+            </tr>
+            <tr>
+              <td>replace</td>
+              <td>RegexReplacement</td>
+              <td>Allows portions of the resulting String to be replaced. If configured, the replace element must
+                specify the regular expression to match and the substitution. This performs a function similar to
+                the RegexReplacement converter but applies to the whole message while the converter only
+                applies to the String its pattern generates.
+              </td>
+            </tr>
+            <caption align="top">Pattern Layout Parameters</caption>
+          </table>
+          <h4>Patterns</h4>
+          <p>
+            The conversions that are provided with Log4j are:
+          </p>
+          <table border="1" width="100%">
+            <tr>
+              <th>Coversion Pattern</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>c</b>{precision}<br />
+                <b>logger</b>{precision}
+              </td>
+              <td>
+                <p>
+                  Used to output the name of the logger that published the logging event. The logger conversion
+                  specifier can be optionally followed by<em>precision specifier</em>, which consists of a
+                  decimal integer, or a pattern starting with a decimal integer.
+                </p>
+                <p>If a precision specifier is given and it is an integer value, then only the corresponding number
+                  of right most components of the logger name will be printed. If the precision contains
+                  other non-integer characters then the name will be abbreviated based on the pattern. If the
+                  precision integer is less than one the right-most token will still be printed in full.
+                  By default the logger name is printed in full.
+                </p>
+                <table border="1" width="100%">
+                  <tr>
+                    <th>Conversion Pattern</th>
+                    <th>Logger Name</th>
+                    <th>Result</th>
+                  </tr>
+                  <tr>
+                    <td>%c{1}</td>
+                    <td>org.apache.commons.Foo</td>
+                    <td>Foo</td>
+                  </tr>
+                  <tr>
+                    <td>%c{2}</td>
+                    <td>org.apache.commons.Foo</td>
+                    <td>commons.Foo</td>
+                  </tr>
+                  <tr>
+                    <td>%c{1.}</td>
+                    <td>org.apache.commons.Foo</td>
+                    <td>o.a.c.Foo</td>
+                  </tr>
+                  <tr>
+                    <td>%c{1.1.~.~}</td>
+                    <td>org.apache.commons.test.Foo</td>
+                    <td>o.a.~.~.Foo</td>
+                  </tr>
+                  <tr>
+                    <td>%c{.}</td>
+                    <td>org.apache.commons.test.Foo</td>
+                    <td>....Foo</td>
+                  </tr>
+                </table>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>C</b>{precision}<br />
+                <b>class</b>{precision}
+              </td>
+              <td>
+                <p>
+                  Used to output the fully qualified class name of the caller issuing the logging request.
+                  This conversion specifier can be optionally followed by<em>precision specifier</em>, that
+                  follows the same rules as the logger name converter.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>d</b>{pattern}<br />
+                <b>date</b>{pattern}
+              </td>
+              <td>
+                <p>
+                  Used to output the date of the logging event. The date conversion specifier may be
+                  followed by a set of braces containing a date and time pattern strings
+                  <a href="http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html">
+                    SimpleDateFormat</a>,
+                  <em>ABSOLUTE</em>,
+                  <em>DATE</em>
+                  or
+                  <em>ISO8601</em>
+                  and a set of braces containing a time zone id per
+                  <a href="http://docs.oracle.com/javase/6/docs/api/java/util/TimeZone.html#getTimeZone(java.lang.String)">
+                    java.util.TimeZone.getTimeZone</a>.
+                  For example,<b>%d{HH:mm:ss,SSS}</b>,<b>%d{dd&nbsp;MMM&nbsp;yyyy&nbsp;HH:mm:ss,SSS}</b>,
+                  <b>%d{DATE}</b>
+                  or<b>%d{HH:mm:ss}{GMT+0}</b>. If no date format specifier is given then
+                  ISO8601 format is assumed.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>F</b><br />
+                <b>file</b>
+              </td>
+              <td>
+                Used to output the file name where the logging request was issued.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>l</b><br />
+                <b>location</b>
+              </td>
+              <td>
+                <p>
+                  Used to output location information of the caller which generated the logging event.
+                </p>
+                <p>
+                  The location information depends on the JVM implementation but usually consists of the fully
+                  qualified name of the calling method followed by the callers source the file name and line
+                  number between parentheses.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>L</b><br />
+                <b>line</b>
+              </td>
+              <td>Used to output the line number from where the logging request
+                was issued.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>m</b><br />
+                <b>msg</b><br />
+                <b>message</b>
+              </td>
+              <td>Used to output the application supplied message associated with the logging event.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>M</b><br />
+                <b>method</b>
+              </td>
+              <td>Used to output the method name where the logging request was issued.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>marker</b>
+              </td>
+              <td>The name of the marker, if one is present.</td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>n</b>
+              </td>
+              <td>
+                <p>
+                  Outputs the platform dependent line separator character or characters.
+                </p>
+                <p>This conversion character offers practically the same
+                  performance as using non-portable line separator strings such as
+                  "\n", or "\r\n". Thus, it is the preferred way of specifying a
+                  line separator.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>p</b><br />
+                <b>level</b>
+              </td>
+              <td>Used to output the level of the logging event.</td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>r</b><br />
+                <b>relative</b>
+              </td>
+              <td>Used to output the number of milliseconds elapsed since the JVM was started until the creation
+                of the logging event.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>replace</b>{pattern}{regex}{substitution}
+              </td>
+              <td>
+                <p>
+                  Replaces occurrences of 'regex', a regular expression, with its replacement 'substitution' in the
+                  string resulting from evaluation of the pattern. For example, "%replace(%msg}{\s}{}" will remove
+                  all spaces contained in the event message.
+                </p>
+                <p>
+                  The pattern can be arbitrarily complex and in particular can contain multiple conversion keywords.
+                  For instance, "%replace{%logger %msg}{\.}{/}" will replace all dots in the logger or the message of
+                  the event with a forward slash.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>t</b><br />
+                <b>thread</b>
+              </td>
+              <td>Used to output the name of the thread that generated the logging event.</td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>x</b><br />
+                <b>NDC</b>
+              </td>
+              <td>Used to output the Thread Context Stack (also known as the Nested Diagnostic Context or NDC)
+                associated with the thread that generated the logging event.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>X</b>{key}<br />
+                <b>MDC</b>{key}
+              </td>
+              <td>
+                <p>Used to output the Thread Context Map (also known as the Mapped Diagnostic Context or MDC)
+                  associated with the thread that generated the logging event. The
+                  <b>X</b>
+                  conversion character can be followed by the key for the
+                  map placed between braces, as in
+                  <b>%X{clientNumber}</b>
+                  where
+                  <code>clientNumber</code>
+                  is the key. The value in the MDC
+                  corresponding to the key will be output. If no additional sub-option
+                  is specified, then the entire contents of the MDC key value pair set
+                  is output using a format {{key1,val1},{key2,val2}}
+                </p>
+                <p>See the
+                  <a href="../../log4j2-api/apidocs/org/apache/logging/log4j/ThreadContext.html">ThreadContext</a>
+                  class for more details.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>ex</b>{depth}<br />
+                <b>exception</b>{depth}<br />
+                <b>throwable</b>{depth}
+              </td>
+              <td>
+                <p>Used to output the Throwable trace that has been bound to the LoggingEvent, by
+                  default this will output the full trace as one would normally find by a call to
+                  Throwable.printStackTrace().
+                  The throwable conversion word can be followed by an option in the form
+                  <b>%throwable{short}</b>
+                  which will only output the first line of the Throwable or <b>%throwable{n}</b> where
+                  the first n lines of the stacktrace will be printed.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>rEx</b>{depth}<br />
+                <b>rException</b>{depth}<br />
+                <b>rThrowable</b>{depth}
+              </td>
+              <td>
+                <p>
+                  The same as the %throwable conversion word but the stack trace is printed starting with the
+                  first exception that was thrown followed by each subsequent wrapping exception.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>xEx</b>{depth}<br />
+                <b>xException</b>{depth}<br />
+                <b>xThrowable</b>{depth}
+              </td>
+              <td>
+                <p>
+                  The same as the %throwable conversion word but also includes class packaging information.
+                </p>
+                <p>
+                  At the end of each stack element of the exception, a string containing the name of the jar file
+                  that contains the class or the directory the class is located in and the "Implementation-Version"
+                  as found in that jar's manifest will be added. If the information is uncertain, then the class
+                  packaging data will be preceded by a tilde, i.e. the '~' character.
+                </p>
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>sn</b><br />
+                <b>sequenceNumber</b>
+              </td>
+              <td>Includes a sequence number that will be incremented in every event. The counter is a
+                static variable so will only be unique within applications that share the same converter Class
+                object.</td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>u</b>{"RANDOM" | "TIME"}<br />
+                <b>uuid</b>
+              </td>
+              <td>Includes either a random or a time-based UUID. The time-based UUID is a Type 1 UUID that can
+                generate up to 10,000 unique ids per millisecond, will use the MAC address of each host, and to
+                try to insure uniqueness across multiple JVMs and/or ClassLoaders on the same host a
+                random number between 0 and 16,384 will be associated with each instance of the UUID generator
+                Class and included in each time-based UUID generated. Because time-based UUIDs contain
+                the MAC address and timestamp they should be used with care as they can cause a security
+                vulnerability.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">
+                <b>%</b>
+              </td>
+              <td>The sequence %% outputs a single percent sign.
+              </td>
+            </tr>
+          </table>
+          <p>By default the relevant information is output as is. However,
+            with the aid of format modifiers it is possible to change the
+            minimum field width, the maximum field width and justification.
+          </p>
+          <p>The optional format modifier is placed between the percent sign
+            and the conversion character.
+          </p>
+          <p>The first optional format modifier is the
+            <em>left justification
+              flag
+            </em>
+            which is just the minus (-) character. Then comes the
+            optional
+            <em>minimum field width</em>
+            modifier. This is a decimal
+            constant that represents the minimum number of characters to
+            output. If the data item requires fewer characters, it is padded on
+            either the left or the right until the minimum width is
+            reached. The default is to pad on the left (right justify) but you
+            can specify right padding with the left justification flag. The
+            padding character is space. If the data item is larger than the
+            minimum field width, the field is expanded to accommodate the
+            data. The value is never truncated.
+          </p>
+          <p>This behavior can be changed using the
+            <em>maximum field
+              width
+            </em>
+            modifier which is designated by a period followed by a
+            decimal constant. If the data item is longer than the maximum
+            field, then the extra characters are removed from the
+            <em>beginning</em>
+            of the data item and not from the end. For
+            example, it the maximum field width is eight and the data item is
+            ten characters long, then the first two characters of the data item
+            are dropped. This behavior deviates from the printf function in C
+            where truncation is done from the end.
+          </p>
+          <p>Below are various format modifier examples for the category
+            conversion specifier.
+          </p>
+          <table BORDER="1" CELLPADDING="8">
+            <tr>
+              <th>Format modifier</th>
+              <th>left justify</th>
+              <th>minimum width</th>
+              <th>maximum width</th>
+              <th>comment</th>
+            </tr>
+            <tr>
+              <td align="center">%20c</td>
+              <td align="center">false</td>
+              <td align="center">20</td>
+              <td align="center">none</td>
+              <td>Left pad with spaces if the category name is less than 20
+                characters long.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">%-20c</td>
+              <td align="center">true</td>
+              <td
+                  align="center">20
+              </td>
+              <td align="center">none</td>
+              <td>Right pad with
+                spaces if the category name is less than 20 characters long.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">%.30c</td>
+              <td align="center">NA</td>
+              <td align="center">none</td>
+              <td align="center">30</td>
+              <td>Truncate from the beginning if the category name is longer than 30
+                characters.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">%20.30c</td>
+              <td align="center">false</td>
+              <td align="center">20</td>
+              <td align="center">30</td>
+              <td>Left pad with spaces if the category name is shorter than 20
+                characters. However, if category name is longer than 30 characters,
+                then truncate from the beginning.
+              </td>
+            </tr>
+            <tr>
+              <td align="center">%-20.30c</td>
+              <td align="center">true</td>
+              <td align="center">20</td>
+              <td align="center">30</td>
+              <td>Right pad with spaces if the category name is shorter than 20
+                characters. However, if category name is longer than 30 characters,
+                then truncate from the beginning.
+              </td>
+            </tr>
+            <caption align="top">Pattern Converters</caption>
+          </table>
         </subsection>
         <a name="RFC5424Layout"/>
         <subsection name="RFC5424Layout">
-
+          <p>
+            As the name implies, the RFC5424Layout formats LogEvents in accordance with
+            <a href="">RFC 5424</a>, the enhanced Syslog specification. Although the specification
+            is primarily directed at sending messages via Syslog, this format is quite useful for
+            other purposes since items are passed in the message as self-describing key/value pairs.
+          </p>
+          <table border="1" width="100%">
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>appName</td>
+              <td>String</td>
+              <td>The value to use as the APP-NAME in the RFC 5424 syslog record.</td>
+            </tr>
+            <tr>
+              <td>charset</td>
+              <td>String</td>
+              <td>The character set to use when converting the syslog String to a byte array. The String must be
+                a valid <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Charset</a>.
+                If not specified, the default system Charset will be used.</td>
+            </tr>
+            <tr>
+              <td>enterpriseNumber</td>
+              <td>integer</td>
+              <td>The IANA enterprise number as described in
+                <a href="http://tools.ietf.org/html/rfc5424#section-7.2.2">RFC 5424</a></td>
+            </tr>
+            <tr>
+              <td>facility</td>
+              <td>String</td>
+              <td>The facility is used to try to classify the message. The facility option must be set to one of
+                "KERN", "USER", "MAIL", "DAEMON", "AUTH", "SYSLOG", "LPR", "NEWS", "UUCP", "CRON", "AUTHPRIV",
+                "FTP", "NTP", "AUDIT", "ALERT", "CLOCK", "LOCAL0", "LOCAL1", "LOCAL2", "LOCAL3", "LOCAL4", "LOCAL5",
+                "LOCAL6", or "LOCAL7". These values may be specified as upper or lower case characters.</td>
+            </tr>
+            <tr>
+              <td>format</td>
+              <td>String</td>
+              <td>If set to "RFC5424" the data will be formatted in accordance with RFC 5424. Otherwise, it will
+                be formatted as a BSD Syslog record. Note that although BSD Syslog records are required to be
+                1024 bytes or shorter the SyslogLayout does not truncate them. The RFC5424Layout also does not
+                truncate records since the receiver must accept records of up to 2048 bytes and may accept records
+                that are longer.</td>
+            </tr>
+            <tr>
+              <td>id</td>
+              <td>String</td>
+              <td>The default structured data id to use when formatting according to RFC 5424. If the LogEvent contains
+                a StructuredDataMessage the id from the Message will be used instead of this value.</td>
+            </tr>
+            <tr>
+              <td>immediateFlush</td>
+              <td>boolean</td>
+              <td>When set to true, each write will be followed by a flush. This will guarantee the data is written
+                to disk but could impact performance.</td>
+            </tr>
+            <tr>
+              <td>includeMDC</td>
+              <td>boolean</td>
+              <td>Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog record.
+                Defaults to true.</td>
+            </tr>
+            <tr>
+              <td>mdcExcludes</td>
+              <td>String</td>
+              <td>A comma separated list of mdc keys that should be excluded from the LogEvent. This is mutually
+                exclusive with the mdcIncludes attribute. This attribute only applies to RFC 5424 syslog records.</td>
+            </tr>
+            <tr>
+              <td>mdcIncludes</td>
+              <td>String</td>
+              <td>A comma separated list of mdc keys that should be included in the FlumeEvent. Any keys in the MDC
+                not found in the list will be excluded. This option is mutually exclusive with the mdcExcludes
+                attribute. This attribute only applies to RFC 5424 syslog records.</td>
+            </tr>
+            <tr>
+              <td>mdcRequired</td>
+              <td>String</td>
+              <td>A comma separated list of mdc keys that must be present in the MDC. If a key is not present a
+                LoggingException will be thrown. This attribute only applies to RFC 5424 syslog records.</td>
+            </tr>
+            <tr>
+              <td>mdcPrefix</td>
+              <td>String</td>
+              <td>A string that should be prepended to each MDC key in order to distinguish it from event attributes.
+                The default string is "mdc:". This attribute only applies to RFC 5424 syslog records.</td>
+            </tr>
+            <tr>
+              <td>messageId</td>
+              <td>String</td>
+              <td>The default value to be used in the MSGID field of RFC 5424 syslog records. </td>
+            </tr>
+            <tr>
+              <td>newLine</td>
+              <td>boolean</td>
+              <td>If true, a newline will be appended to the end of the syslog record. The default is false.</td>
+            </tr>
+            <caption align="top">RFC5424Layout Parameters</caption>
+          </table>
         </subsection>
         <a name="SerializedLayout"/>
         <subsection name="SerializedLayout">
+          <p>
+            The SerializedLayout simply serializes the LogEvent into a byte array. This is useful when
+            sending messages via JMS or via a Socket connection. The SerializedLayout accepts no parameters.
+          </p>
         </subsection>
         <a name="SyslogLayout"/>
         <subsection name="SyslogLayout">
-
+          <p>
+            The SyslogLayout formats the LogEvent as BSD Syslog records matching the same format used by
+            Log4j 1.2.
+          </p>
+           <table border="1" width="100%">
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>charset</td>
+              <td>String</td>
+              <td>The character set to use when converting the syslog String to a byte array. The String must be
+                a valid <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Charset</a>.
+                If not specified, the default system Charset will be used.</td>
+            </tr>
+            <tr>
+              <td>facility</td>
+              <td>String</td>
+              <td>The facility is used to try to classify the message. The facility option must be set to one of
+                "KERN", "USER", "MAIL", "DAEMON", "AUTH", "SYSLOG", "LPR", "NEWS", "UUCP", "CRON", "AUTHPRIV",
+                "FTP", "NTP", "AUDIT", "ALERT", "CLOCK", "LOCAL0", "LOCAL1", "LOCAL2", "LOCAL3", "LOCAL4", "LOCAL5",
+                "LOCAL6", or "LOCAL7". These values may be specified as upper or lower case characters.</td>
+            </tr>
+            <tr>
+              <td>newLine</td>
+              <td>boolean</td>
+              <td>If true, a newline will be appended to the end of the syslog record. The default is false.</td>
+            </tr>
+            <caption align="top">SyslogLayout Parameters</caption>
+          </table>
         </subsection>
         <a name="XMLLayout"/>
         <subsection name="XMLLayout">
-
+          <p>
+            The output of the XMLLayout consists of a series of log4j:event
+            elements as defined in the<a href="log4j.dtd">log4j.dtd</a>. If configured to do so it will
+            output a complete well-formed XML file. The output is designed to be
+            included as an
+            <em>external entity</em>
+            in a separate file to form
+            a correct XML file.
+          </p>
+          <p>For example, if <code>abc</code> is the name of the file where
+            the XMLLayout ouput goes, then a well-formed XML file would be:
+          </p>
+          <pre>
+            &lt;?xml version="1.0" ?&gt;
+            *
+            &lt;!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd" [&lt;!ENTITY data SYSTEM "abc"&gt;]&gt;
+            *
+            &lt;log4j:eventSet version="2.0" xmlns:log4j="http://logging.apache.org/log4j/"&gt;
+            &nbsp;&nbsp;&data;
+            &lt;/log4j:eventSet&gt;
+          </pre>
+          <p>
+            This approach enforces the independence of the XMLLayout and the appender where it is embedded.
+          </p>
+          <p>
+            The <code>version</code> attribute helps components to correctly intrepret output generated by XMLLayout.
+            The value of this attribute should be "2.0".
+          </p>
+          <p>
+            Appenders using this layout should have their encoding set to UTF-8 or UTF-16, otherwise events containing
+            non ASCII characters could result in corrupted log files.
+          </p>
         </subsection>
       </section>
     </body>



Mime
View raw message