log4cplus  2.0.0
Public Member Functions | Protected Attributes
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]

List of all members.

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)

Protected Attributes

log4cplus::tstring dateFormat
bool use_gmtime = false
bool thread_printing = true
bool category_prefixing = true
bool context_printing = true

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

log4cplus::TTCCLayout::TTCCLayout ( bool  use_gmtime = false,
bool  thread_printing = true,
bool  category_prefixes = true,
bool  context_printing = true 
)
virtual log4cplus::TTCCLayout::~TTCCLayout ( ) [virtual]

Member Function Documentation

Implements log4cplus::Layout.


Member Data Documentation

Definition at line 190 of file layout.h.

bool log4cplus::TTCCLayout::context_printing = true [protected]

Definition at line 191 of file layout.h.

Definition at line 187 of file layout.h.

bool log4cplus::TTCCLayout::thread_printing = true [protected]

Definition at line 189 of file layout.h.

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: