Hello

Attached is a patch that shows how the examples from src/examples could
be linked to the phpdoc API docs as well as to the regular site
documentation.

As a suggestion I would rename them from syslog.php to
appender_syslog.php and from xml.php to configurator_xml.php etc. so
that it is not ambiguous whether it's an example for the the XML
appender or the XML configurator.

bye,

-christian-


Index: src/main/php/appenders/LoggerAppenderSyslog.php
===================================================================
--- src/main/php/appenders/LoggerAppenderSyslog.php	(Revision 811826)
+++ src/main/php/appenders/LoggerAppenderSyslog.php	(Arbeitskopie)
@@ -21,12 +21,13 @@
  * Log events using php {...@link PHP_MANUAL#syslog} function.
  *
  * Levels are mapped as follows:
- * - <b>level &gt;= FATAL</b> to LOG_ALERT
- * - <b>FATAL &gt; level &gt;= ERROR</b> to LOG_ERR 
- * - <b>ERROR &gt; level &gt;= WARN</b> to LOG_WARNING
- * - <b>WARN  &gt; level &gt;= INFO</b> to LOG_INFO
- * - <b>INFO  &gt; level &gt;= DEBUG</b> to LOG_DEBUG
+ * - <b>level >= FATAL</b> to LOG_ALERT
+ * - <b>FATAL > level >= ERROR</b> to LOG_ERR 
+ * - <b>ERROR > level >= WARN</b> to LOG_WARNING
+ * - <b>WARN  > level >= INFO</b> to LOG_INFO
+ * - <b>INFO  > level >= DEBUG</b> to LOG_DEBUG
  *
+ * @example ../../examples/php/syslog.php   An example how to use the LoggerAppenderSyslog class
  * @version $Revision$
  * @package log4php
  * @subpackage appenders
Index: src/site/site.xml
===================================================================
--- src/site/site.xml	(Revision 811826)
+++ src/site/site.xml	(Arbeitskopie)
@@ -57,6 +57,8 @@
 			<item name="Filter" href="/docs/appender-filter.html"/>
 			<item name="Renderer" href="/docs/renderer.html"/> 
 			<item name="Performance" href="/docs/performance.html"/>
+			<item name="-------------"/>
+			<item name="Examples" href="/docs/examples.html"/>
         </menu>
         
         <menu name="Community">
Index: src/site/apt/docs/examples.apt
===================================================================
--- src/site/apt/docs/examples.apt	(Revision 0)
+++ src/site/apt/docs/examples.apt	(Revision 0)
@@ -0,0 +1,39 @@
+~~ 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.
+ ------
+ Apache log4php Examples
+ ------
+ ------
+ ------
+
+Apache Log4php Examples
+
+  The source contains ready to run examples for most appenders and major concepts in the src/examples/ directory.
+  Some of them are shown below.
+
+Appender
+
+  LoggerAppenderSyslog
+  
+%{snippet|id=foo|file=src/examples/php/syslog.php}
+
+%{snippet|id=foo|file=src/examples/resources/syslog.properties}
+
+  LoggerAppenderMail
+
+%{snippet|id=foo|file=src/examples/php/mail.php}
+  
+%{snippet|id=foo|file=src/examples/resources/mail.properties}
+  
\ No newline at end of file
Index: src/examples/php/syslog.php
===================================================================
--- src/examples/php/syslog.php	(Revision 811826)
+++ src/examples/php/syslog.php	(Arbeitskopie)
@@ -15,9 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+// START SNIPPET: foo
 require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
 Logger::configure(dirname(__FILE__).'/../resources/syslog.properties');
 $logger = Logger::getRootLogger();
 $logger->fatal("Hello World!");
+// END SNIPPET: foo
 ?>
Index: src/examples/php/mail.php
===================================================================
--- src/examples/php/mail.php	(Revision 811826)
+++ src/examples/php/mail.php	(Arbeitskopie)
@@ -15,9 +15,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+// START SNIPPET: foo
 require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
 Logger::configure(dirname(__FILE__).'/../resources/mail.properties');
 $logger = Logger::getRootLogger();
 $logger->fatal("Some critical message!");
+// END SNIPPET: foo
 ?>
Index: src/examples/resources/syslog.properties
===================================================================
--- src/examples/resources/syslog.properties	(Revision 811826)
+++ src/examples/resources/syslog.properties	(Arbeitskopie)
@@ -15,8 +15,10 @@
 ; See the License for the specific language governing permissions and
 ; limitations under the License.
 ;
+; START SNIPPET: foo
 log4php.appender.default = LoggerAppenderSyslog
 log4php.appender.default.layout = LoggerLayoutSimple
 log4php.appender.default.ident = log4php-test
 log4php.appender.default.facility = LOG_LOCAL0
 log4php.rootLogger = DEBUG, default
+; END SNIPPET: foo
\ No newline at end of file
Index: src/examples/resources/mail.properties
===================================================================
--- src/examples/resources/mail.properties	(Revision 811826)
+++ src/examples/resources/mail.properties	(Arbeitskopie)
@@ -15,9 +15,11 @@
 ; See the License for the specific language governing permissions and
 ; limitations under the License.
 ;
+; START SNIPPET: foo
 log4php.appender.email = LoggerAppenderMail
 log4php.appender.email.layout = LoggerLayoutTTCC
 log4php.appender.email.from = [email protected]
 log4php.appender.email.to = [email protected]
 log4php.appender.email.subject = Log4php test
 log4php.rootLogger = FATAL, email
+; END SNIPPET: foo
\ No newline at end of file

Reply via email to