You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by ch...@apache.org on 2009/10/06 20:46:44 UTC
svn commit: r822422 - in /incubator/log4php/trunk/src: examples/php/
examples/resources/ main/php/configurators/ site/apt/docs/
Author: chammers
Date: Tue Oct 6 18:46:44 2009
New Revision: 822422
URL: http://svn.apache.org/viewvc?rev=822422&view=rev
Log:
* Examples for the various Configurator classes. They are referenced
from the classes phpdoc and the configuration.apt.
* No code change
Added:
incubator/log4php/trunk/src/examples/php/configurator_basic.php
incubator/log4php/trunk/src/examples/php/configurator_php.php
incubator/log4php/trunk/src/examples/php/configurator_xml.php
incubator/log4php/trunk/src/examples/resources/configurator_php.php
incubator/log4php/trunk/src/examples/resources/configurator_xml.xml
Modified:
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorBasic.php
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php
incubator/log4php/trunk/src/site/apt/docs/configuration.apt
Added: incubator/log4php/trunk/src/examples/php/configurator_basic.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/configurator_basic.php?rev=822422&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/configurator_basic.php (added)
+++ incubator/log4php/trunk/src/examples/php/configurator_basic.php Tue Oct 6 18:46:44 2009
@@ -0,0 +1,8 @@
+<?php
+// START SNIPPET: doxia
+define('LOG4PHP_CONFIGURATOR_CLASS', 'LoggerConfiguratorBasic');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+$logger = Logger::getRootLogger();
+$logger->info("Hello World!");
+// END SNIPPET: doxia
Added: incubator/log4php/trunk/src/examples/php/configurator_php.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/configurator_php.php?rev=822422&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/configurator_php.php (added)
+++ incubator/log4php/trunk/src/examples/php/configurator_php.php Tue Oct 6 18:46:44 2009
@@ -0,0 +1,8 @@
+<?php
+// START SNIPPET: doxia
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/configurator_php.php', 'LoggerConfiguratorPhp');
+$logger = Logger::getRootLogger();
+$logger->info("Hello World!");
+// END SNIPPET: doxia
Added: incubator/log4php/trunk/src/examples/php/configurator_xml.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/configurator_xml.php?rev=822422&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/configurator_xml.php (added)
+++ incubator/log4php/trunk/src/examples/php/configurator_xml.php Tue Oct 6 18:46:44 2009
@@ -0,0 +1,9 @@
+<?php
+// START SNIPPET: doxia
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/configurator_xml.xml');
+$logger = Logger::getRootLogger();
+$logger->info("Hello World!");
+// END SNIPPET: doxia
+
Added: incubator/log4php/trunk/src/examples/resources/configurator_php.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/configurator_php.php?rev=822422&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/configurator_php.php (added)
+++ incubator/log4php/trunk/src/examples/resources/configurator_php.php Tue Oct 6 18:46:44 2009
@@ -0,0 +1,26 @@
+<?php
+
+return array(
+ 'threshold' => 'ALL',
+ 'rootLogger' => array(
+ 'level' => 'INFO',
+ 'appenders' => array('default'),
+ ),
+ 'loggers' => array(
+ 'dev' => array(
+ 'level' => 'DEBUG',
+ 'appenders' => array('default'),
+ ),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderEcho',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutPattern',
+ 'conversionPattern' => "%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n",
+ ),
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Added: incubator/log4php/trunk/src/examples/resources/configurator_xml.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/configurator_xml.xml?rev=822422&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/configurator_xml.xml (added)
+++ incubator/log4php/trunk/src/examples/resources/configurator_xml.xml Tue Oct 6 18:46:44 2009
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/"
+ threshold="all" debug="false">
+ <appender name="default" class="LoggerAppenderEcho">
+ <layout class="LoggerLayoutTTCC" />
+ </appender>
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</log4php:configuration>
\ No newline at end of file
Modified: incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorBasic.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorBasic.php?rev=822422&r1=822421&r2=822422&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorBasic.php (original)
+++ incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorBasic.php Tue Oct 6 18:46:44 2009
@@ -15,13 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
* Use this class to quickly configure the package.
*
- * <p>For file based configuration see {@link LoggerConfiguratorIni}.
- * <p>For XML based configuration see {@link LoggerConfiguratorXml}.
+ * An example how to use this configurator:
+ *
+ * {@example ../../examples/php/configurator_basic.php}
*
* @version $Revision$
* @package log4php
Modified: incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php?rev=822422&r1=822421&r2=822422&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php (original)
+++ incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php Tue Oct 6 18:46:44 2009
@@ -15,12 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
* Allows the configuration of log4php from an external file.
*
- * See {@link doConfigure()} for the expected format.
+ * <p>This is the most commonly used method of configuring log4php.</p>
*
* <p>It is sometimes useful to see how log4php is reading configuration
* files. You can enable log4php internal logging by defining the
@@ -29,14 +30,13 @@
* <p>The <i>LoggerConfiguratorIni</i> does not handle the
* advanced configuration features supported by the {@link LoggerConfiguratorXml}
* such as support for {@link LoggerFilter},
- custom {@link LoggerErrorHandlers}, nested appenders such as the
- {@link Logger AsyncAppender},
- * etc.
+ * custom {@link LoggerErrorHandlers}, nested appenders such as the {@link Logger AsyncAppender},
+ * etc.</p>
*
* <p>All option <i>values</i> admit variable substitution. The
* syntax of variable substitution is similar to that of Unix
- * shells. The string between an opening <b>"${"</b> and
- * closing <b>"}"</b> is interpreted as a key. The value of
+ * shells. The string between an opening <b>"${"</b> and
+ * closing <b>"}"</b> is interpreted as a key. The value of
* the substituted variable can be defined as a system property or in
* the configuration file itself. The value of the key is first
* searched in the defined constants, in the enviroments variables
@@ -60,10 +60,18 @@
* </code>
* </p>
*
+ * <p>An example how to use this appender:</p>
+ *
+ * {@example ../../examples/php/appender_dailyfile.php}
+ *
+ * <p>And the corresponding ini file:</p>
+ *
+ * {@example ../../examples/resources/appender_dailyfile.properties}
+ *
* @version $Revision$
* @package log4php
* @subpackage configurators
- * @since 0.5
+ * @since 0.5
*/
class LoggerConfiguratorIni implements LoggerConfigurator {
const CATEGORY_PREFIX = "log4php.category.";
Modified: incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php?rev=822422&r1=822421&r2=822422&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php (original)
+++ incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php Tue Oct 6 18:46:44 2009
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
@@ -23,32 +24,13 @@
* This class allows configuration of log4php through an external file that
* deliver a PHP array in return.
*
- * Example:
- * <code>
- * <?php
- * return array(
- * 'threshold' => 'ALL',
- * 'rootLogger' => array(
- * 'level' => 'INFO',
- * 'appenders' => array('default'),
- * ),
- * 'loggers' => array(
- * 'dev' => array(
- * 'level' => 'DEBUG',
- * 'appenders' => array('default'),
- * ),
- * ),
- * 'appenders' => array(
- * 'default' => array(
- * 'class' => 'LoggerAppenderEcho',
- * 'layout' => array(
- * 'class' => 'LoggerPatternLayout',
- * 'conversionPattern' => "%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n",
- * ),
- * ),
- * ),
- * );
- * </code>
+ * An example for this configurator is:
+ *
+ * {@example ../../examples/php/configurator_php.php}
+ *
+ * Which includes the following snippet:
+ *
+ * {@example ../../examples/resources/configurator_php.php}
*
* @package log4php
* @subpackage configurators
Modified: incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php?rev=822422&r1=822421&r2=822422&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php (original)
+++ incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php Tue Oct 6 18:46:44 2009
@@ -15,25 +15,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
- * Use this class to initialize the log4php environment using expat parser.
+ * Use this class to initialize the log4php environment using XML files.
*
* <p>Read the log4php.dtd included in the documentation directory. Note that
* php parser does not validate the document.</p>
*
* <p>Sometimes it is useful to see how log4php is reading configuration
* files. You can enable log4php internal logging by setting the <var>debug</var>
- * attribute in the <var>log4php:configuration</var> element. As in
- * <pre>
- * <log4php:configuration <b>debug="true"</b> xmlns:log4php="http://logging.apache.org/log4php/">
- * ...
- * </log4php:configuration>
- * </pre>
+ * attribute in the <var>log4php:configuration</var> element.</p>
*
- * <p>There are sample XML files included in the package under <b>tests/</b>
- * subdirectories.</p>
+ * <p>An example for this configurator:</p>
+ *
+ * {@example ../../examples/php/configurator_xml.php}<br>
+ *
+ * <p>The corresponding XML file:</p>
+ *
+ * {@example ../../examples/resources/configurator_xml.xml}
+ *
+ * <p>There are more sample XML files included in the package under tests/ subdirectories.</p>
*
* @version $Revision$
* @package log4php
Modified: incubator/log4php/trunk/src/site/apt/docs/configuration.apt
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/site/apt/docs/configuration.apt?rev=822422&r1=822421&r2=822422&view=diff
==============================================================================
--- incubator/log4php/trunk/src/site/apt/docs/configuration.apt (original)
+++ incubator/log4php/trunk/src/site/apt/docs/configuration.apt Tue Oct 6 18:46:44 2009
@@ -91,7 +91,7 @@
+--
The invocation of the Logger::configure method creates
- a rather simple log4j setup. This method is hardwired to add to the
+ a rather simple log4php setup. This method is hardwired to add to the
root logger a ConsoleAppender. The output will be formatted using a PatternLayout
set to the pattern "%-4r [%t] %-5p %c %x - %m%n".