Return-Path: Delivered-To: apmail-logging-log4php-dev-archive@www.apache.org Received: (qmail 4988 invoked from network); 6 Sep 2009 21:43:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Sep 2009 21:43:45 -0000 Received: (qmail 51678 invoked by uid 500); 6 Sep 2009 21:43:45 -0000 Delivered-To: apmail-logging-log4php-dev-archive@logging.apache.org Received: (qmail 51615 invoked by uid 500); 6 Sep 2009 21:43:45 -0000 Mailing-List: contact log4php-dev-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4PHP Dev" List-Id: Delivered-To: mailing list log4php-dev@logging.apache.org Received: (qmail 51607 invoked by uid 99); 6 Sep 2009 21:43:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Sep 2009 21:43:45 +0000 X-ASF-Spam-Status: No, hits=3.5 required=10.0 tests=SPF_PASS,URIBL_BLACK X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [212.117.79.78] (HELO mail3b1.westend.com) (212.117.79.78) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Sep 2009 21:43:29 +0000 Received: from localhost (localhost [127.0.0.1]) by mail3b1.westend.com (Postfix) with ESMTP id 935BA1A3A9B2F for ; Sun, 6 Sep 2009 23:43:09 +0200 (CEST) X-Spam-Score: -9.639 X-Spam-Level: Received: from mail3b1.westend.com ([127.0.0.1]) by localhost (mail3b.westend.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yIvMRbKtsaFp for ; Sun, 6 Sep 2009 23:43:07 +0200 (CEST) Received: from james.intern (xdsl-87-79-50-154.netcologne.de [87.79.50.154]) by mail3b1.westend.com (Postfix) with ESMTP id 44B851A3A9B2A for ; Sun, 6 Sep 2009 23:43:07 +0200 (CEST) Date: Sun, 6 Sep 2009 23:43:07 +0200 From: Christian Hammers To: "Log4PHP Dev" Subject: Patch for examples Message-ID: <20090906234307.08c10e96@james.intern> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.5; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/R6zOsD.VxKhNGK6KSLXL+/P" X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-9.639 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, LATHSPELL_WHITELIST=-10, RCVD_IN_PBL=0.905, RDNS_DYNAMIC=0.1, URIBL_BLACK=1.955] --MP_/R6zOsD.VxKhNGK6KSLXL+/P Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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- --MP_/R6zOsD.VxKhNGK6KSLXL+/P Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=examples.diff 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: - * - level >= FATAL to LOG_ALERT - * - FATAL > level >= ERROR to LOG_ERR - * - ERROR > level >= WARN to LOG_WARNING - * - WARN > level >= INFO to LOG_INFO - * - INFO > level >= DEBUG to LOG_DEBUG + * - level >= FATAL to LOG_ALERT + * - FATAL > level >= ERROR to LOG_ERR + * - ERROR > level >= WARN to LOG_WARNING + * - WARN > level >= INFO to LOG_INFO + * - INFO > level >= DEBUG 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 @@ + + 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 = someone@example.com log4php.appender.email.to = log4php@example.com log4php.appender.email.subject = Log4php test log4php.rootLogger = FATAL, email +; END SNIPPET: foo \ No newline at end of file --MP_/R6zOsD.VxKhNGK6KSLXL+/P--