Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B10E88F1 for ; Tue, 30 Aug 2011 12:23:00 +0000 (UTC) Received: (qmail 56235 invoked by uid 500); 30 Aug 2011 12:23:00 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 56210 invoked by uid 500); 30 Aug 2011 12:23:00 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 56203 invoked by uid 99); 30 Aug 2011 12:22:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2011 12:22:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2011 12:22:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 46C1123889DE; Tue, 30 Aug 2011 12:22:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1163184 - in /logging/log4php/trunk/src: main/php/layouts/LoggerLayoutXml.php site/apt/docs/appender/layout.apt Date: Tue, 30 Aug 2011 12:22:35 -0000 To: commits@logging.apache.org From: ihabunek@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110830122235.46C1123889DE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ihabunek Date: Tue Aug 30 12:22:34 2011 New Revision: 1163184 URL: http://svn.apache.org/viewvc?rev=1163184&view=rev Log: Updated documentation for the LoggerLayoutXML and added examples to site docs. Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php logging/log4php/trunk/src/site/apt/docs/appender/layout.apt Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php?rev=1163184&r1=1163183&r2=1163184&view=diff ============================================================================== --- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php (original) +++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php Tue Aug 30 12:22:34 2011 @@ -21,8 +21,13 @@ /** * The output of the LoggerXmlLayout consists of a series of log4php:event elements. * - *

Parameters: {@link $locationInfo}.

- * + * Configurable parameters: + * - {@link $locationInfo} - If set to true then the file name and line number + * of the origin of the log statement will be included in output. + * - {@link $log4jNamespace} - If set to true then log4j namespace will be used + * instead of log4php namespace. This can be usefull when using log viewers + * which can only parse the log4j namespace such as Apache Chainsaw. + * *

It does not output a complete well-formed XML file. * The output is designed to be included as an external entity in a separate file to form * a correct XML file.

Modified: logging/log4php/trunk/src/site/apt/docs/appender/layout.apt URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/apt/docs/appender/layout.apt?rev=1163184&r1=1163183&r2=1163184&view=diff ============================================================================== --- logging/log4php/trunk/src/site/apt/docs/appender/layout.apt (original) +++ logging/log4php/trunk/src/site/apt/docs/appender/layout.apt Tue Aug 30 12:22:34 2011 @@ -253,7 +253,7 @@ log4php.appender.default.layout = Logger ** {LoggerLayoutXml} - The LoggerLayoutXml formats the message as a XML fragment. + The LoggerLayoutXml formats the messages as an XML document. *** Configurable parameters @@ -263,9 +263,26 @@ log4php.appender.default.layout = Logger *---------------------+--------------*-------------------+------------------------+ | locationInfo | No | true | If set to true then the file name and line number of the origin of the log statement will be included in output. *---------------------+--------------*-------------------+------------------------+ +| log4jNamespace | No | false | If set to true then log4j 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. +*---------------------+--------------*-------------------+------------------------+ *** Examples + This layout will by default include the Nested Diagnostic Context if any is present. + + Consider the following code snippet: + ++-- +$logger = Logger::getLogger('myLogger'); + +LoggerNDC::push('foo'); +$logger->info("My first message."); +LoggerNDC::push('bar'); +$logger->info("My second message."); ++-- + +**** Example 1: default configuration + Configuration via XML file: +-- @@ -281,7 +298,7 @@ log4php.appender.default = LoggerAppende log4php.appender.default.layout = LoggerLayoutXml +-- - Sample output: + The resulting output: +-- @@ -296,12 +313,43 @@ log4php.appender.default.layout = Logger + ++-- - - - - - +**** Example 2: log4j namespace, without location information + + Configuration via XML file: + ++-- + + + + + + ++-- + + Configuration via ini file: + ++-- +log4php.appender.default = LoggerAppenderEcho +log4php.appender.default.layout = LoggerLayoutXml +log4php.appender.default.layout.locationInfo = false +log4php.appender.default.layout.log4jNamespace = true ++-- + + The resulting output: - +-- + + + + + + + + + + + ++-- \ No newline at end of file