You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2012/11/01 20:17:14 UTC

svn commit: r1404729 - /logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml

Author: ggregory
Date: Thu Nov  1 19:17:14 2012
New Revision: 1404729

URL: http://svn.apache.org/viewvc?rev=1404729&view=rev
Log:
Document new highlight{pattern}{style} feature.

Modified:
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml?rev=1404729&r1=1404728&r2=1404729&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml Thu Nov  1 19:17:14 2012
@@ -20,6 +20,7 @@
     <properties>
         <title>Log4j 2 Layouts</title>
         <author email="rgoers@apache.org">Ralph Goers</author>
+        <author email="ggregory@apache.org">Gary Gregory</author>
     </properties>
 
     <body>
@@ -266,12 +267,97 @@
             </tr>
             <tr>
               <td align="center">
-                <b>highlight</b>{pattern}
+                <b>highlight</b>{pattern}{style}
               </td>
               <td>
-                Adds ANSI colors to the result of the enclosed pattern based on the current event's logging level.
-                The result will be in blinking bright red when the level is FATAL, bright red when the level is
-                ERROR, red when the level is WARN, blue when the level is INFO and normal for DEBUG and TRACE levels.
+                <p>Adds ANSI colors to the result of the enclosed pattern based on the current event's logging level.
+                </p>
+                <p>The default colors for each level are:
+                 <table border="1" width="100%">
+                   <tr>
+                     <th>Level</th>
+                     <th>ANSI color</th>
+                   </tr>
+                   <tr>
+                     <td>FATAL</td>
+                     <td>Bright red</td>
+                   </tr>
+                   <tr>
+                     <td>ERROR</td>
+                     <td>Bright red</td>
+                   </tr>
+                   <tr>
+                     <td>WARN</td>
+                     <td>Yellow</td>
+                   </tr>
+                   <tr>
+                     <td>INFO</td>
+                     <td>Green</td>
+                   </tr>
+                   <tr>
+                     <td>DEBUG</td>
+                     <td>Cyan</td>
+                   </tr>
+                   <tr>
+                     <td>TRACE</td>
+                     <td>Black (looks dark grey)</td>
+                   </tr>
+                 </table>                 
+                </p>
+                <p>The color names are ANSI names defined in the <a href="../log4j2-core/apidocs/index.html">AnsiEscape</a> class.
+                </p>
+                <p>The default colors can be overridden in the optional style option. For example:
+                 <pre>%highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{FATAL=white, ERROR=red, WARN=blue, INFO=black, DEBUG=green, TRACE=blue}</pre>
+                </p>
+                <p>You can also use the STYLE key to use a predefined group of colors:
+                 <pre>%highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{STYLE=Logback}</pre>
+                 The style can be one of:
+                 <table border="1" width="100%">
+                   <tr>
+                     <th>Style</th>
+                     <th>Description</th>
+                   </tr>
+                   <tr>
+                     <td>Default</td>
+                     <td>See above</td>
+                   </tr>
+                   <tr>
+                     <td>Logback</td>
+                     <td>
+                       <table border="1" width="100%">
+                         <tr>
+                           <th>Level</th>
+                           <th>ANSI color</th>
+                         </tr>
+                         <tr>
+                           <td>FATAL</td>
+                           <td>Blinking bright red</td>
+                         </tr>
+                         <tr>
+                           <td>ERROR</td>
+                           <td>Bright red</td>
+                         </tr>
+                         <tr>
+                           <td>WARN</td>
+                           <td>Red</td>
+                         </tr>
+                         <tr>
+                           <td>INFO</td>
+                           <td>Blue</td>
+                         </tr>
+                         <tr>
+                           <td>DEBUG</td>
+                           <td>Normal</td>
+                         </tr>
+                         <tr>
+                           <td>TRACE</td>
+                           <td>Normal</td>
+                         </tr>
+                       </table>                                      
+                     </td>
+                   </tr>
+                 </table>                 
+                </p>
               </td>
             </tr>
             <tr>