Class LoggerLayoutHtml

Description

This layout outputs events in a HTML table.

Configurable parameters for this layout are:

  • title
  • locationInfo
An example for this layout:

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

The corresponding XML file:

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

The above will print a HTML table that looks, converted back to plain text, like the following:

    Log session start time Wed Sep 9 00:11:30 2009

    Time Thread Level Category   Message
    0    8318   INFO  root       Hello World!

  • version: $Revision: 883108 $

Located in /layouts/LoggerLayoutHtml.php (line 49)

LoggerLayout
   |
   --LoggerLayoutHtml
Method Summary
LoggerLayoutHtml __construct ()
string format (LoggerLoggingEvent $event)
string getContentType ()
string getFooter ()
string getHeader ()
void getLocationInfo ()
string getTitle ()
void setLocationInfo ( $flag)
void setTitle ( $title)
Methods
Constructor __construct (line 76)

Constructor

  • access: public
LoggerLayoutHtml __construct ()
format (line 132)
  • access: public
string format (LoggerLoggingEvent $event)

Redefinition of:
LoggerLayout::format()
Override this method to create your own layout format.
getContentType (line 124)
  • return: Returns the content type output by this layout, i.e "text/html".
  • access: public
string getContentType ()

Redefinition of:
LoggerLayout::getContentType()
Returns the content type output by this layout.
getFooter (line 221)
  • return: Returns the appropriate HTML footers.
  • access: public
string getFooter ()

Redefinition of:
LoggerLayout::getFooter()
Returns the footer for the layout format.
getHeader (line 188)
  • return: Returns appropriate HTML headers.
  • access: public
string getHeader ()

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

Returns the current value of the LocationInfo option.

  • access: public
void getLocationInfo ()
getTitle (line 117)
  • return: Returns the current value of the Title option.
  • access: public
string getTitle ()
setLocationInfo (line 90)

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.

<p>If you are embedding this layout within a LoggerAppenderMail or a LoggerAppenderMailEvent then make sure to set the LocationInfo option of that appender as well.

  • access: public
void setLocationInfo ( $flag)
  • $flag
setTitle (line 110)

The Title option takes a String value. This option sets the document title of the generated HTML document.

Defaults to 'Log4php Log Messages'.

  • access: public
void setTitle ( $title)
  • $title

Inherited Methods

Inherited From LoggerLayout

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

Documentation generated on Fri, 27 Nov 2009 07:44:50 +0100 by phpDocumentor 1.4.3