Class LoggerLayoutTTCC

Description

TTCC layout format consists of time, thread, category and nested diagnostic context information, hence the name.

Each of the four fields can be individually enabled or disabled. The time format depends on the DateFormat used.

If no dateFormat is specified it defaults to '%c'. See php http://www.php.net/date function for details.

Configurable parameters for this layout are:

An example how to use this layout:
  1. require_once dirname(__FILE__).'/../../main/php/Logger.php';
  2.  
  3. Logger::configure(dirname(__FILE__).'/../resources/layout_ttcc.properties');
  4. $logger Logger::getRootLogger();
  5. $logger->info("Hello World!");

  1. log4php.appender.default = LoggerAppenderEcho
  2. log4php.appender.default.layout = LoggerLayoutTTCC
  3. log4php.appender.default.layout.MicroSecondsPrinting = false
  4. log4php.appender.default.layout.categoryPrefixing = true
  5. log4php.appender.default.layout.dateFormat = "%H:%M"
  6. log4php.rootLogger = DEBUG, default

The above would print:
02:28 [13714] INFO root - Hello World!

  • version: $Revision: 883108 $

Located in /layouts/LoggerLayoutTTCC.php (line 51)

LoggerLayout
   |
   --LoggerLayoutTTCC
Class Constant Summary
Variable Summary
Method Summary
LoggerLayoutTTCC __construct ([string $dateFormat = ''])
string format (LoggerLoggingEvent $event)
boolean getContextPrinting ()
string getDateFormat ()
boolean getThreadPrinting ()
void setCategoryPrefixing ( $categoryPrefixing)
void setContextPrinting ( $contextPrinting)
void setDateFormat ( $dateFormat)
void setMicroSecondsPrinting ( $microSecondsPrinting)
void setThreadPrinting ( $threadPrinting)
Variables
mixed $categoryPrefixing = true (line 69)
  • access: protected
mixed $contextPrinting = true (line 70)
  • access: protected
string $dateFormat = '%c' (line 76)
mixed $microSecondsPrinting = true (line 71)
  • access: protected
mixed $threadPrinting = true (line 68)
  • access: protected
Methods
Constructor __construct (line 84)

Constructor

LoggerLayoutTTCC __construct ([string $dateFormat = ''])
  • string $dateFormat: date format
format (line 177)

In addition to the level of the statement and message, the returned string includes time, thread, category.

Time, thread, category are printed depending on options.

  • access: public
string format (LoggerLoggingEvent $event)

Redefinition of:
LoggerLayout::format()
Override this method to create your own layout format.
getCategoryPrefixing (line 119)
  • return: Returns value of the CategoryPrefixing option.
  • access: public
boolean getCategoryPrefixing ()
getContextPrinting (line 135)
  • return: Returns value of the ContextPrinting option.
  • access: public
boolean getContextPrinting ()
getDateFormat (line 165)
  • access: public
string getDateFormat ()
getMicroSecondsPrinting (line 153)
  • return: Returns value of the MicroSecondsPrinting option.
  • access: public
boolean getMicroSecondsPrinting ()
getThreadPrinting (line 104)
  • return: Returns value of the ThreadPrinting option.
  • access: public
boolean getThreadPrinting ()
ignoresThrowable (line 212)
  • access: public
void ignoresThrowable ()
setCategoryPrefixing (line 112)

The CategoryPrefixing option specifies whether Category name is part of log output or not. This is true by default.

  • access: public
void setCategoryPrefixing ( $categoryPrefixing)
  • $categoryPrefixing
setContextPrinting (line 128)

The ContextPrinting option specifies log output will include the nested context information belonging to the current thread.

This is true by default.

  • access: public
void setContextPrinting ( $contextPrinting)
  • $contextPrinting
setDateFormat (line 158)
  • access: public
void setDateFormat ( $dateFormat)
  • $dateFormat
setMicroSecondsPrinting (line 144)

The MicroSecondsPrinting option specifies if microseconds infos should be printed at the end of timestamp.

This is true by default.

  • access: public
void setMicroSecondsPrinting ( $microSecondsPrinting)
  • $microSecondsPrinting
setThreadPrinting (line 95)

The ThreadPrinting option specifies whether the name of the current thread is part of log output or not. This is true by default.

  • access: public
void setThreadPrinting ( $threadPrinting)
  • $threadPrinting

Inherited Methods

Inherited From LoggerLayout

LoggerLayout::activateOptions()
LoggerLayout::format()
LoggerLayout::getContentType()
LoggerLayout::getFooter()
LoggerLayout::getHeader()
Class Constants
LOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT = 'NULL' (line 58)

String constant designating no time information. Current value of this constant is NULL.

LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT = 'RELATIVE' (line 65)

String constant designating relative time. Current value of this constant is RELATIVE.

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