log4cplus  2.1.0
Public Member Functions | Protected Attributes | List of all members
log4cplus::TTCCLayout Class Reference

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

#include <layout.h>

Inheritance diagram for log4cplus::TTCCLayout:
[legend]
Collaboration diagram for log4cplus::TTCCLayout:
[legend]

Public Member Functions

 TTCCLayout (bool use_gmtime=false, bool thread_printing=true, bool category_prefixes=true, bool context_printing=true)
 
 TTCCLayout (const log4cplus::helpers::Properties &properties)
 
virtual ~TTCCLayout ()
 
virtual void formatAndAppend (log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
 
bool getThreadPrinting () const
 
void setThreadPrinting (bool)
 
bool getCategoryPrefixing () const
 
void setCategoryPrefixing (bool)
 
bool getContextPrinting () const
 
void setContextPrinting (bool)
 
- Public Member Functions inherited from log4cplus::Layout
 Layout ()
 
 Layout (const helpers::Properties &properties)
 
virtual ~Layout ()=0
 

Protected Attributes

log4cplus::tstring dateFormat
 
bool use_gmtime = false
 
bool thread_printing = true
 
bool category_prefixing = true
 
bool context_printing = true
 
- Protected Attributes inherited from log4cplus::Layout
LogLevelManagerllmCache
 

Detailed Description

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

The time format depends on the DateFormat used. Use the Use_gmtime to specify whether messages should be logged using localtime or gmtime. There are also ThreadPrinting, CategoryPrefixing and ContextPrinting properties to turn on and off thread name, logger name and NDC context printing respectively.

Here is an example TTCCLayout output:

1 [0x60004dca0] WARN test.TestThread <> - Thread-3 TestThread.run()- Starting...
1 [0x60004dca0] TRACE SlowObject <Thread-3 loop> - ENTER: SlowObject::doSomething()
2 [0x60004b030] INFO SlowObject <Thread-0 loop> - Actually doing something...1, 2, 3, testing...DONE
2 [0x60004b130] INFO SlowObject <Thread-1 loop> - Actually doing something...
2 [0x60004b030] TRACE SlowObject <Thread-0 loop> - EXIT: SlowObject::doSomething()
2 [0x60004b030] TRACE SlowObject <Thread-0 loop> - ENTER: SlowObject::doSomething()
3 [0x60004b130] INFO SlowObject <Thread-1 loop> - Actually doing something...1, 2, 3, testing...DONE
3 [0x60004cad0] INFO SlowObject <Thread-2 loop> - Actually doing something...

The first field is the number of milliseconds elapsed since the start of the program.

The second field is the thread outputting the log statement. (The value is the same as that of the t formatter for PatternLayout.)

The third field is the LogLevel.

The fourth field is the logger to which the statement belongs.

The fifth field (just before the '-') is the nested diagnostic context. Note the nested diagnostic context may be empty as in the first two statements. The text after the '-' is the message of the statement.

PatternLayout offers a much more flexible alternative.

Definition at line 165 of file layout.h.

Constructor & Destructor Documentation

◆ TTCCLayout() [1/2]

log4cplus::TTCCLayout::TTCCLayout ( bool  use_gmtime = false,
bool  thread_printing = true,
bool  category_prefixes = true,
bool  context_printing = true 
)

◆ TTCCLayout() [2/2]

log4cplus::TTCCLayout::TTCCLayout ( const log4cplus::helpers::Properties properties)

◆ ~TTCCLayout()

virtual log4cplus::TTCCLayout::~TTCCLayout ( )
virtual

Member Function Documentation

◆ formatAndAppend()

virtual void log4cplus::TTCCLayout::formatAndAppend ( log4cplus::tostream output,
const log4cplus::spi::InternalLoggingEvent event 
)
virtual

Implements log4cplus::Layout.

◆ getCategoryPrefixing()

bool log4cplus::TTCCLayout::getCategoryPrefixing ( ) const

◆ getContextPrinting()

bool log4cplus::TTCCLayout::getContextPrinting ( ) const

◆ getThreadPrinting()

bool log4cplus::TTCCLayout::getThreadPrinting ( ) const

◆ setCategoryPrefixing()

void log4cplus::TTCCLayout::setCategoryPrefixing ( bool  )

◆ setContextPrinting()

void log4cplus::TTCCLayout::setContextPrinting ( bool  )

◆ setThreadPrinting()

void log4cplus::TTCCLayout::setThreadPrinting ( bool  )

Member Data Documentation

◆ category_prefixing

bool log4cplus::TTCCLayout::category_prefixing = true
protected

Definition at line 190 of file layout.h.

◆ context_printing

bool log4cplus::TTCCLayout::context_printing = true
protected

Definition at line 191 of file layout.h.

◆ dateFormat

log4cplus::tstring log4cplus::TTCCLayout::dateFormat
protected

Definition at line 187 of file layout.h.

◆ thread_printing

bool log4cplus::TTCCLayout::thread_printing = true
protected

Definition at line 189 of file layout.h.

◆ use_gmtime

bool log4cplus::TTCCLayout::use_gmtime = false
protected

Definition at line 188 of file layout.h.


The documentation for this class was generated from the following file: