Class LoggerLayoutXml

Description

The output of the LoggerXmlLayout consists of a series of log4php:event elements.

Configurable parameters:

  • $locationInfo - If set to true then the file name and line number of the origin of the log statement will be included in output.
  • $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.
<p>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.</p>

Example:

  1. require_once dirname(__FILE__).'/../../main/php/Logger.php';
  2.  
  3. Logger::configure(dirname(__FILE__).'/../resources/layout_xml.properties');
  4. $logger Logger::getRootLogger();
  5. $logger->info("Hello World!");

  1. log4php.appender.default = LoggerAppenderEcho
  2. log4php.appender.default.layout = LoggerLayoutXml
  3. log4php.rootLogger = DEBUG, default

The above would print:

 
     
         
         
     
 

  • version: $Revision: 1213283 $

Located in /layouts/LoggerLayoutXml.php (line 56)

LoggerConfigurable
   |
   --LoggerLayout
      |
      --LoggerLayoutXml
Class Constant Summary
 CDATA_EMBEDDED_END = ']]>]]&gt;<![CDATA['
 CDATA_END = ']]>'
 CDATA_PSEUDO_END = ']]&gt;'
 CDATA_START = '<![CDATA['
 LOG4J_NS = 'http://jakarta.apache.org/log4j/'
 LOG4J_NS_PREFIX = 'log4j'
 LOG4PHP_NS = 'http://logging.apache.org/log4php/'
 LOG4PHP_NS_PREFIX = 'log4php'
Variable Summary
Method Summary
void activateOptions ()
void encodeCDATA (string $string)
string format (LoggerLoggingEvent $event)
string getFooter ()
string getHeader ()
boolean getLocationInfo ()
boolean getLog4jNamespace ()
void setLocationInfo ( $flag)
void setLog4jNamespace (boolean $flag)
Variables
boolean $locationInfo = true (line 73)

If set to true then the file name and line number of the origin of the log statement will be output.

  • access: protected
boolean $log4jNamespace = false (line 80)

If set to true, log4j namespace will be used instead of the log4php namespace.

  • access: protected
mixed $namespace = self::LOG4PHP_NS (line 83)

The namespace in use.

  • access: protected
mixed $namespacePrefix = self::LOG4PHP_NS_PREFIX (line 86)

The namespace prefix in use

  • access: protected
Methods
activateOptions (line 88)
  • access: public
void activateOptions ()

Redefinition of:
LoggerLayout::activateOptions()
Activates options for this layout.
encodeCDATA (line 205)

Encases a string in CDATA tags, and escapes any existing CDATA end tags already present in the string.

  • access: private
void encodeCDATA (string $string)
  • string $string
format (line 115)

Formats a LoggerLoggingEvent in conformance with the log4php.dtd.

  • access: public
string format (LoggerLoggingEvent $event)

Redefinition of:
LoggerLayout::format()
Override this method to create your own layout format.
getFooter (line 162)
  • access: public
string getFooter ()

Redefinition of:
LoggerLayout::getFooter()
Returns the footer for the layout format.
getHeader (line 101)
  • access: public
string getHeader ()

Redefinition of:
LoggerLayout::getHeader()
Returns the header for the layout format.
getLocationInfo (line 171)

Whether or not file name and line number will be included in the output.

  • access: public
boolean getLocationInfo ()
getLog4jNamespace (line 189)
  • access: public
boolean getLog4jNamespace ()
setLocationInfo (line 182)

The $locationInfo option takes a boolean value. By default,

it is set to false which means there will be no location information output by this layout. If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output.

  • access: public
void setLocationInfo ( $flag)
  • $flag
setLog4jNamespace (line 196)
  • access: public
void setLog4jNamespace (boolean $flag)
  • boolean $flag

Inherited Methods

Inherited From LoggerLayout

LoggerLayout::activateOptions()
LoggerLayout::format()
LoggerLayout::getContentType()
LoggerLayout::getFooter()
LoggerLayout::getHeader()
LoggerLayout::warn()

Inherited From LoggerConfigurable

LoggerConfigurable::setBoolean()
LoggerConfigurable::setFileSize()
LoggerConfigurable::setInteger()
LoggerConfigurable::setLevel()
LoggerConfigurable::setNumeric()
LoggerConfigurable::setPositiveInteger()
LoggerConfigurable::setString()
LoggerConfigurable::warn()
Class Constants
CDATA_EMBEDDED_END = ']]>]]&gt;<![CDATA[' (line 66)
CDATA_END = ']]>' (line 64)
CDATA_PSEUDO_END = ']]&gt;' (line 65)
CDATA_START = '<![CDATA[' (line 63)
LOG4J_NS = 'http://jakarta.apache.org/log4j/' (line 58)
LOG4J_NS_PREFIX = 'log4j' (line 57)
LOG4PHP_NS = 'http://logging.apache.org/log4php/' (line 61)
LOG4PHP_NS_PREFIX = 'log4php' (line 60)

Documentation generated on Sat, 18 Feb 2012 22:32:25 +0000 by phpDocumentor 1.4.3