Added: logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/pattern.xml URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/pattern.xml?rev=1180048&view=auto ============================================================================== --- logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/pattern.xml (added) +++ logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/pattern.xml Fri Oct 7 14:14:10 2011 @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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 xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> + + <properties> + <title>LoggerLayoutPattern</title> + </properties> + + <body> + <section name="LoggerLayoutPattern"> + + <p>LoggerLayoutPattern is a flexible layout configurable via a conversion pattern.</p> + + <subsection name="Options"> + <p>The following options are available:</p> + + <table> + <tr> + <th>Parameter</th> + <th>Type</th> + <th>Required</th> + <th>Default</th> + <th>Description</th> + </tr> + <tr> + <td>conversionPattern</td> + <td>string</td> + <td>No</td> + <td>%m%n</td> + <td>String which controls the output. See full specification below.</td> + </tr> + </table> + + <h4>Conversion patterns</h4> + + <p>This is the string which controls formatting and consists of a mix of literal content and + conversion specifiers.</p> + + <p>The conversion pattern is closely related to the conversion pattern of the + <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf" target="_blank">printf</a> + function in C. It is composed of literal text and format control expressions called conversion + specifiers. You are free to insert any literal text within the conversion pattern.</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 recognized conversion specifiers + are:</p> + + <table> + <tr> + <th>Conversion character</th> + <th>Converts to</th> + </tr> + <tr> + <td> + <p><code>%c</code></p> + <p><code>%c{<![CDATA[<precision>]]>}</code></p> + </td> + <td> + <p>Name of the Logger object which recieved the logging request.</p> + + <p>Optionally, it can be can followed by <em>precision specifier</em>, which is a + decimal constant in brackets. If a precision specifier is given, then only the + corresponding number of right most components of the logger name will be printed.</p> + + <p>For example, if the logger is named <code>foo.bar.Baz</code>, then <code>%c</code> + will be translated to the full logger name, <code>%c{2}</code> will be translated to + <code>bar.Baz</code>, and <code>%c{1}</code> will be translated to <code>Baz</code>. + </p> + </td> + </tr> + <tr> + <td> + <p><code>%C</code></p> + <p><code>%C{<![CDATA[<precision>]]>}</code></p> + </td> + <td> + <p>The fully qualified class name of the caller issuing the logging request. Currently, + this will always return "Logger".</p> + </td> + </tr> + <tr> + <td> + <p><code>%d</code></p> + <p><code>%d{<![CDATA[<format>]]>}</code></p> + </td> + <td> + <p>The date of the logging event.</p> + + <p>Optionally, may be followed by a <em>date format specifier</em> enclosed between + braces. The format specifier follows the PHP + <a href="http://php.net/manual/en/function.date.php">date</a> function. If no date + format specifier is given then ISO8601 format is assumed (Y-m-d H:i:s,u). </p> + + <p>For example: <code>%d{Y-m-d H:i:s}</code></p> + </td> + </tr> + <tr> + <td><code>%F</code></td> + <td>Name of the file from which the logging request was issued.</td> + </tr> + <tr> + <td><code>%l</code></td> + <td> + <p>Location information of the caller which generated the logging event.</p> + <p>Identical to <code>%C.%M(%F:%L)</code></p> + </td> + </tr> + <tr> + <td><code>%L</code></td> + <td>The line number at which the logging request was issued.</td> + </tr> + <tr> + <td><code>%m</code></td> + <td>The message associated with the logging event.</td> + </tr> + <tr> + <td><code>%n</code></td> + <td> + <p>A platform dependent line-break character(s).</p> + <p>Note that a line break will not be printed unless explicitely specified.</p> + </td> + </tr> + <tr> + <td><code>%M</code></td> + <td>The method or function name from which the logging request was issued.</td> + </tr> + <tr> + <td><code>%p</code></td> + <td>The level of the logging event.</td> + </tr> + <tr> + <td><code>%r</code></td> + <td>The number of milliseconds elapsed since the start of the application until the creation of the logging event.</td> + </tr> + <tr> + <td><code>%t</code></td> + <td>The ID of the process that generated the logging event.</td> + </tr> + <tr> + <td><code>%x</code></td> + <td>The NDC (Nested Diagnostic Context) associated with the thread that generated the logging event.</td> + </tr> + <tr> + <td><code>%X{<![CDATA[<key>]]>}</code></td> + <td> + <p>The MDC (Mapped Diagnostic Context) associated with the thread that generated the + logging event.</p> + <p>The X conversion character must be followed by the MDC key in braces. The value in + the MDC corresponding to the key will be output.</p> + </td> + </tr> + <tr> + <td><code>%%</code></td> + <td>A single percent sign.</td> + </tr> + </table> + </subsection> + + <subsection name="Format modifiers"> + <p>By default the relevant information is output as-is. However, with the aid of format modifiers + it is possible to change the minimum and maximum width and the justifications of each data field. + </p> + + <p>All format modifiers are optional, and are placed between the percent sign and the conversion + character.</p> + + <p>The first format modifier is the <em>left justification flag</em> which is just the minus (-) + character.</p> + + <p>Then comes the <em>>minimum field width</em> modifier. This is an integer 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 an integer. If the data item is longer than the maximum field, then the + extra characters are removed from the beginning 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>The following table demonstrates various uses of format modifiers:</p> + + <table> + <tr> + <th>Format modifier</th> + <th>Justification</th> + <th>Minimum width</th> + <th>Maximum width</th> + <th>Comment</th> + </tr> + <tr> + <td align="center"><code>%c</code></td> + <td align="center">none</td> + <td align="center">none</td> + <td align="center">none</td> + <td>Output the logger name as-is.</td> + </tr> + <tr> + <td align="center"><code>%20c</code></td> + <td align="center">right</td> + <td align="center">20</td> + <td align="center">none</td> + <td>Left pad with spaces if the logger name is less than 20 characters long.</td> + </tr> + <tr> + <td align="center"><code>%-20c</code></td> + <td align="center">left</td> + <td align="center">20</td> + <td align="center">none</td> + <td>Right pad with spaces if the logger name is less than 20 characters long.</td> + </tr> + <tr> + <td align="center"><code>%.30c</code></td> + <td align="center">none</td> + <td align="center">none</td> + <td align="center">30</td> + <td>Truncate from the beginning if the logger name is longer than 30 characters.</td> + </tr> + <tr> + <td align="center"><code>%20.30c</code></td> + <td align="center">right</td> + <td align="center">20</td> + <td align="center">30</td> + <td>Left pad with spaces if the logger name is shorter than 20 characters. However, if + the logger name is longer than 30 characters, then truncate from the beginning.</td> + </tr> + <tr> + <td align="center"><code>%-20.30c</code></td> + <td align="center">true</td> + <td align="center">20</td> + <td align="center">30</td> + <td>Right pad with spaces if the logger name is shorter than 20 characters. However, if the + logger name is longer than 30 characters, then truncate from the beginning.</td> + </tr> + </table> + + </subsection> + + + <subsection name="Examples"> + + <p>The following configuration configures a <code>LoggerAppenderEcho</code> which uses the pattern + layout. All examples will use the same code and configuration, only the conversion pattern will + change.</p> + + <p>Save the configuration to a file called <code>layout_pattern.xml</code>.</p> + +<pre class="prettyprint"><![CDATA[ +<configuration xmlns="http://logging.apache.org/log4php/"> + <appender name="default" class="LoggerAppenderEcho"> + <layout class="LoggerLayoutPattern"> + <param name="conversionPattern" value="%d{Y-m-d H:i:s.u} %c %-5p %m%n" /> + </layout> + </appender> + <root> + <appender_ref ref="default" /> + </root> +</configuration> +]]></pre> + + <p>Run the following code:</p> + +<pre class="prettyprint"> +Logger::configure("layout_pattern.xml"); +$logger = Logger::getLogger('myLogger'); +$logger->info("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); +$logger->debug("Donec a diam lectus."); +$logger->warn("Sed sit amet ipsum mauris."); +</pre> + + <h4>Pattern example</h4> + <p>Conversion pattern: <code>%d %c %-5p %m%n</code></p> + + <p>Produces the following output:</p> + +<pre> +2011-09-28 09:29:38,602 myLogger INFO Lorem ipsum dolor sit amet, consectetur adipiscing elit. +2011-09-28 09:29:38,603 myLogger DEBUG Donec a diam lectus. +2011-09-28 09:29:38,604 myLogger WARN Sed sit amet ipsum mauris. +</pre> + + <p>In this example, <code>%d</code> produces the event datetime in default format + (<code>Y-m-d H:i:s,u</code>), and <code>%-5p</code> produces the event level right padded to 5 + characters. Since longest level name is 5 characters long, this ensures that the message always + starts at the same character position which improves log readability.</p> + </subsection> + </section> + </body> +</document>
Added: logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/simple.xml URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/simple.xml?rev=1180048&view=auto ============================================================================== --- logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/simple.xml (added) +++ logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/simple.xml Fri Oct 7 14:14:10 2011 @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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 xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> + + <properties> + <title>LoggerLayoutSimple</title> + </properties> + + <body> + <section name="LoggerLayoutSimple"> + + <p><code>LoggerLayoutSimple</code> is a basic layout which outputs only the level followed by the message.</p> + + <p>It is interesting to note that the output of <code>LoggerLayoutSimple</code> is identical to that of + <code><a href="pattern.html">LoggerLayoutPattern</a></code> with the <em>conversion pattern</em> set to + <code>%p - %m%n</code>.</p> + + + <subsection name="Options"> + <p>This layout does not have any configurable options.</p> + </subsection> + + <subsection name="Examples"> + + <p>Configuration:</p> + +<pre class="prettyprint"><![CDATA[ +<configuration xmlns="http://logging.apache.org/log4php/"> + <appender name="default" class="LoggerAppenderEcho"> + <layout class="LoggerLayoutSimple" /> + </appender> + <root> + <appender_ref ref="default" /> + </root> +</configuration> +]]></pre> + + <p>Running the following code:</p> + +<pre class="prettyprint linenums"> +Logger::configure("layout_xml.xml"); +$log = Logger::getRootLogger(); +$log->info("My first message."); +$log->debug("My second message."); +$log->warn("My third message."); +</pre> + + <p>Produces the following output:</p> + +<pre class="prettyprint"><![CDATA[ +INFO - My first message. +DEBUG - My second message. +WARN - My third message. +]]></pre> + + </subsection> + </section> + </body> +</document> Added: logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/ttcc.xml URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/ttcc.xml?rev=1180048&view=auto ============================================================================== --- logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/ttcc.xml (added) +++ logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/ttcc.xml Fri Oct 7 14:14:10 2011 @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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 xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> + + <properties> + <title>LoggerLayoutTTCC</title> + </properties> + + <body> + <section name="LoggerLayoutTTCC"> + + <p>The TTCC layout format was taken from Apache log4j, and originally consisted of Time, Thread, Category + and nested diagnostic Context information, hence the name.</p> + + <p><code>LoggerLayoutTTCC</code> contains equivalent information:</p> + <ul> + <li>Time</li> + <li>Process ID</li> + <li>Logger name</li> + <li>Nested diagnostic context</li> + </ul> + + <p>Output of <code>LoggerLayoutTTCC</code> is identical to that of + <code><a href="pattern.html">LoggerLayoutPattern</a></code> with the <em>conversion pattern</em> set to + <code>%d{m/d/y H:i:s,u} [%t] %p %c %x - %m%n</code>.</p> + + <subsection name="Options"> + + <p>The following options are available:</p> + + <table> + <tr> + <th>Parameter</th> + <th>Type</th> + <th>Required</th> + <th>Default</th> + <th>Description</th> + </tr> + <tr> + <td>threadPrinting</td> + <td>boolean</td> + <td>No</td> + <td>true</td> + <td>If set to true, the process ID will be included in output.</td> + </tr> + <tr> + <td>categoryPrefixing</td> + <td>boolean</td> + <td>No</td> + <td>true</td> + <td>If set to true, the logger name will be included in output.</td> + </tr> + <tr> + <td>contextPrinting</td> + <td>boolean</td> + <td>No</td> + <td>true</td> + <td>If set to true, the nested diagnostic context will be included in output.</td> + </tr> + <tr> + <td>microSecondsPrinting</td> + <td>boolean</td> + <td>No</td> + <td>true</td> + <td>If set to true, the microseconds will be included in output.</td> + </tr> + <tr> + <td>microSecondsPrinting</td> + <td>string</td> + <td>No</td> + <td>%c</td> + <td>Overrides the date format, using the format used in PHP + <code> + <a class="externalLink" target="_blank" href="http://php.net/manual/en/function.strftime.php">strftime()</a> + </code> function.</td> + </tr> + + </table> + </subsection> + + <subsection name="Examples"> + + <p>Configuration:</p> + +<pre class="prettyprint"><![CDATA[ +<configuration xmlns="http://logging.apache.org/log4php/"> + <appender name="default" class="LoggerAppenderEcho"> + <layout class="LoggerLayoutTTCC" /> + </appender> + <root> + <appender_ref ref="default" /> + </root> +</configuration> +]]></pre> + + <p>Running the following code:</p> + +<pre class="prettyprint linenums"> +Logger::configure("config.xml"); +$logger = Logger::getLogger('myLogger'); +$logger->info("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); +$logger->debug("Donec a diam lectus."); +$logger->warn("Sed sit amet ipsum mauris."); +</pre> + + <p>Produces the following output:</p> + +<pre class="prettyprint"><![CDATA[ +INFO - My first message. +DEBUG - My second message. +WARN - My third message. +]]></pre> + + </subsection> + </section> + </body> +</document> Added: logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/xml.xml URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/xml.xml?rev=1180048&view=auto ============================================================================== --- logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/xml.xml (added) +++ logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/layouts/xml.xml Fri Oct 7 14:14:10 2011 @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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 xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> + + <properties> + <title>LoggerLayoutXml</title> + </properties> + + <body> + <section name="LoggerLayoutXml"> + + <p><code>LoggerLayoutXml</code> formats the messages as an XML document.</p> + + <subsection name="Options" id="Options"> + <p>The following options are available:</p> + + <table> + <tr> + <th>Parameter</th> + <th>Type</th> + <th>Required</th> + <th>Default</th> + <th>Description</th> + </tr> + <tr> + <td>locationInfo</td> + <td>boolean</td> + <td>No</td> + <td>true</td> + <td>If set to true, adds the file name and line number at which the log statement originated.</td> + </tr> + <tr> + <td>log4jNamespace</td> + <td>boolean</td> + <td>No</td> + <td>false</td> + <td>If set to true then log4j XML namespace will be used instead of the log4php namespace. + This can be usefull when using log viewers which can only parse the log4j namespace such as + Apache Chainsaw.</td> + </tr> + </table> + + </subsection> + + <subsection name="Examples"> + + <h4>Default configuration example</h4> + + <p>The default configuration of <code>LoggerLayoutXml</code> will use the log4php XML namespace and + include the location information.</p> + + <p>Configuration file:</p> + +<pre class="prettyprint"><![CDATA[ +<configuration xmlns="http://logging.apache.org/log4php/"> + <appender name="default" class="LoggerAppenderEcho"> + <layout class="LoggerLayoutXml" /> + </appender> + <root> + <appender_ref ref="default" /> + </root> +</configuration> +]]></pre> + + <p>Running the following code:</p> + +<pre class="prettyprint linenums"> +Logger::configure("config.xml"); +$logger = Logger::getLogger('myLogger'); +$logger->info("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); +$logger->debug("Donec a diam lectus."); +$logger->warn("Sed sit amet ipsum mauris."); +</pre> + + <p>Produces the following output:</p> + +<pre class="prettyprint"><![CDATA[ +<log4php:eventSet xmlns:log4php="http://logging.apache.org/log4php/" version="0.3" includesLocationInfo="true"> + +<log4php:event logger="myLogger" level="INFO" thread="4464" timestamp="1317215164482"> +<log4php:message><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit.]]]]><![CDATA[>]]><![CDATA[</log4php:message> +<log4php:locationInfo class="main" file="D:\Temp\log4php\layout_pattern.php" line="5" method="main" /> +</log4php:event> + +<log4php:event logger="myLogger" level="DEBUG" thread="4464" timestamp="1317215164513"> +<log4php:message><![CDATA[Donec a diam lectus.]]]]><![CDATA[>]]><![CDATA[</log4php:message> +<log4php:locationInfo class="main" file="D:\Temp\log4php\layout_pattern.php" line="6" method="main" /> +</log4php:event> + +<log4php:event logger="myLogger" level="WARN" thread="4464" timestamp="1317215164514"> +<log4php:message><![CDATA[Sed sit amet ipsum mauris.]]]]><![CDATA[>]]><![CDATA[</log4php:message> +<log4php:locationInfo class="main" file="D:\Temp\log4php\layout_pattern.php" line="7" method="main" /> +</log4php:event> + +</log4php:eventSet> +]]></pre> + + + <h4>Overriding default options</h4> + + <p>This example show how to configure <code>LoggerLayoutXml</code> to exclude the location information + and use the log4j XML namespace.</p> + + <p>Configuration file:</p> + +<pre class="prettyprint"><![CDATA[ +<configuration xmlns="http://logging.apache.org/log4php/"> + <appender name="default" class="LoggerAppenderEcho"> + <layout class="LoggerLayoutXml"> + <param name="locationInfo" value="false" /> + <param name="log4jNamespace" value="true" /> + </layout> + </appender> + <root> + <appender_ref ref="default" /> + </root> +</configuration> +]]></pre> + <p>Using this configuration will produce the following output:</p> + +<pre class="prettyprint"><![CDATA[ +<log4j:eventSet xmlns:log4j="http://jakarta.apache.org/log4j/" version="0.3" includesLocationInfo="false"> +<log4j:event logger="myLogger" level="INFO" thread="3156" timestamp="1317216571470"> +<log4j:message><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit.]]]]><![CDATA[>]]><![CDATA[</log4j:message> +</log4j:event> + +<log4j:event logger="myLogger" level="DEBUG" thread="3156" timestamp="1317216571471"> +<log4j:message><![CDATA[Donec a diam lectus.]]]]><![CDATA[>]]><![CDATA[</log4j:message> +</log4j:event> + +<log4j:event logger="myLogger" level="WARN" thread="3156" timestamp="1317216571471"> +<log4j:message><![CDATA[Sed sit amet ipsum mauris.]]]]><![CDATA[>]]><![CDATA[</log4j:message> +</log4j:event> + +</log4j:eventSet> +]]></pre> + + </subsection> + </section> + </body> +</document> Added: logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/threshold.xml URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/threshold.xml?rev=1180048&view=auto ============================================================================== --- logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/threshold.xml (added) +++ logging/log4php/branches/experimental/config-adapters/src/site/xdoc/docs/threshold.xml Fri Oct 7 14:14:10 2011 @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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 xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> + + <properties> + <title>Threshold</title> + </properties> + + <body> + <section name="Threshold"> + + + + <p>A threshold is lets you filter out log events of a specified LoggerLevel on an + Appender-Level and on Configuration-Level. This is sometimes an easier option + than changing the LoggerLevel of the several components.</p> + + <subsection name="Default configuration"> + + + + </subsection> + + + </section> + </body> +</document> Added: logging/log4php/branches/experimental/config-adapters/src/site/xdoc/quickstart.xml URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/site/xdoc/quickstart.xml?rev=1180048&view=auto ============================================================================== --- logging/log4php/branches/experimental/config-adapters/src/site/xdoc/quickstart.xml (added) +++ logging/log4php/branches/experimental/config-adapters/src/site/xdoc/quickstart.xml Fri Oct 7 14:14:10 2011 @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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 xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> + + <properties> + <title>Quick start</title> + </properties> + + <body> + <section name="Quick start"> + + <p>First, <a href="install.html">install Apache log4php</a>.</p> + + <p>You may also like to read the <a href="docs/introduction.html">introduction chapter</a> to familiarise + yoursef with the basic concepts used throughout the documentation and examples.</p> + + <subsection name="A trivial example"> + <p>Just want logging to stdout?</p> + +<pre class="prettyprint linenums"> +include('log4php/Logger.php'); +$logger = Logger::getLogger("main"); +$logger->info("foo"); +$logger->warn("bar"); +</pre> + + <p>This produces the following output:</p> + +<pre> +Sun Jul 26 01:40:23 2009,021 [10093] INFO main - foo +Sun Jul 26 01:40:23 2009,030 [10093] WARN main - bar +</pre> + + </subsection> + + <subsection name="A simple example"> + <p>This example demonstrates how to log messages to a file, but only with level greater or equal to + WARN.</p> + + <p>Create a configuration file named <code>log4php.xml</code> containing:</p> + +<pre class="prettyprint linenums"><![CDATA[ +<configuration xmlns="http://logging.apache.org/log4php/"> + <appender name="myAppender" class="LoggerAppenderFile"> + <param name="file" value="myLog.log" /> + </appender> + <root> + <level value="WARN" /> + <appender_ref ref="myAppender" /> + </root> +</configuration> +]]></pre> + + <p>This configuration file:</p> + + <ul> + <li>Creates an appender named <code>myAppender</code> using appender class <code> + <a href="docs/appenders.html#LoggerAppenderFile">LoggerAppenderFile</a></code> which is used for + logging to a file (on line 2).</li> + + <li>Sets the <code>file</code> parameter, which is required for LoggerAppenderFile, to the path + to the file in which events will be logged (on line 3).</li> + + <li>Sets the root logger level to <code>WARN</code> (on line 6)). This means that logging requests + with the level lower than WARN will be ignored.</li> + + <li>Links <code>myAppender</code> to the root logger (on line 7) so that all events recieved by the root + logger will be forwarded to <code>myAppender</code> and written into the log file.</li> + </ul> + + <p>To try it out, run the following code:</p> + +<pre class="prettyprint linenums"><![CDATA[ +// Insert the path where you unpacked log4php +include('log4php/Logger.php'); + +// Tell log4php to use our configuration file. +Logger::configure('log4php.xml'); + +// Fetch a logger, it will inherit settings from the root logger +$log = Logger::getLogger('myLogger'); + +// Start logging +$log->trace("My first message."); // Not logged because TRACE < WARN +$log->debug("My second message."); // Not logged because DEBUG < WARN +$log->info("My third message."); // Not logged because INFO < WARN +$log->warn("My fourth message."); // Logged because WARN >= WARN +$log->error("My fifth message."); // Logged because ERROR >= WARN +$log->fatal("My sixth message."); // Logged because FATAL >= WARN +]]></pre> + + <p>This will create a file named <code>myLog.log</code> containing the following output:</p> + +<pre><![CDATA[ +WARN - My fourth message. +ERROR - My fifth message. +FATAL - My sixth message. +]]></pre> + + + </subsection> + </section> + </body> +</document>