Apache Log4cxx  Version 1.3.1
Loading...
Searching...
No Matches
log4cxx::spi::LoggingEvent Class Reference

The data recorded for each logging request. More...

#include <loggingevent.h>

Inheritance diagram for log4cxx::spi::LoggingEvent:
log4cxx::helpers::Object

Public Types

typedef spi::KeySet KeySet
 

Public Member Functions

 LoggingEvent ()
 An empty event.
 
 LoggingEvent (const LogString &logger, const LevelPtr &level, const LocationInfo &location, LogString &&message)
 An event composed using the supplied parameters.
 
 LoggingEvent (const LogString &logger, const LevelPtr &level, const LogString &message, const LocationInfo &location)
 An event composed using the supplied parameters.
 
 ~LoggingEvent ()
 
const LevelPtrgetLevel () const
 The severity level of the logging request that generated this event.
 
const LogStringgetLoggerName () const
 The name of the logger used to make the logging request.
 
const LogStringgetMessage () const
 The message provided in the logging request.
 
const LogStringgetRenderedMessage () const
 The message provided in the logging request.
 
const LogStringgetThreadName () const
 The identity of the thread in which this logging event was created.
 
const LogStringgetThreadUserName () const
 The name you gave to the thread in which this logging event was created.
 
log4cxx_time_t getTimeStamp () const
 The number of microseconds elapsed since 1970-01-01 at the time this logging event was created.
 
std::chrono::time_point< std::chrono::system_clock > getChronoTimeStamp () const
 The value of the system clock at the time this logging event was created.
 
const LocationInfogetLocationInformation () const
 The source code location where the logging request was made.
 
bool getNDC (LogString &dest) const
 Add the current nested diagnostic context to the end of dest.
 
bool getMDC (const LogString &key, LogString &dest) const
 Add the value associated with key to the end of dest.
 
KeySet getMDCKeySet () const
 The keys in the mapped diagnostic context for the event.
 
void getMDCCopy () const
 Obtain a copy of the current thread's diagnostic context data.
 
void LoadDC () const
 Obtain a copy of the current thread's diagnostic context data.
 
bool getProperty (const LogString &key, LogString &dest) const
 Append onto dest the value associated with the property key.
 
KeySet getPropertyKeySet () const
 The set of of the key values in the properties for the event.
 
void setProperty (const LogString &key, const LogString &value)
 Associate value with the property key.
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual const helpers::ClassgetClass () const =0
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Static Public Member Functions

static log4cxx_time_t getStartTime ()
 The number of microseconds elapsed since 1970-01-01 at the time the application started.
 

Detailed Description

The data recorded for each logging request.

Each logging request instantiates a LoggingEvent instance, which Log4cxx provides to filters, layouts and appenders.

This class is of concern to those wishing to extend log4cxx.

Member Typedef Documentation

◆ KeySet

Constructor & Destructor Documentation

◆ LoggingEvent() [1/3]

log4cxx::spi::LoggingEvent::LoggingEvent ( )

An empty event.

◆ LoggingEvent() [2/3]

log4cxx::spi::LoggingEvent::LoggingEvent ( const LogString logger,
const LevelPtr level,
const LocationInfo location,
LogString &&  message 
)

An event composed using the supplied parameters.

Parameters
loggerThe logger used to make the logging request.
levelThe severity of this event.
locationThe source code location of the logging request.
messageThe text to add to this event.

◆ LoggingEvent() [3/3]

log4cxx::spi::LoggingEvent::LoggingEvent ( const LogString logger,
const LevelPtr level,
const LogString message,
const LocationInfo location 
)

An event composed using the supplied parameters.

Parameters
loggerThe logger used to make the logging request.
levelThe severity of this event.
messageThe text to add to this event.
locationThe source code location of the logging request.

◆ ~LoggingEvent()

log4cxx::spi::LoggingEvent::~LoggingEvent ( )

Member Function Documentation

◆ getChronoTimeStamp()

std::chrono::time_point< std::chrono::system_clock > log4cxx::spi::LoggingEvent::getChronoTimeStamp ( ) const

The value of the system clock at the time this logging event was created.

◆ getLevel()

const LevelPtr & log4cxx::spi::LoggingEvent::getLevel ( ) const

The severity level of the logging request that generated this event.

◆ getLocationInformation()

const LocationInfo & log4cxx::spi::LoggingEvent::getLocationInformation ( ) const

The source code location where the logging request was made.

◆ getLoggerName()

const LogString & log4cxx::spi::LoggingEvent::getLoggerName ( ) const

The name of the logger used to make the logging request.

◆ getMDC()

bool log4cxx::spi::LoggingEvent::getMDC ( const LogString key,
LogString dest 
) const

Add the value associated with key to the end of dest.

The diagnostic context must have been loaded into this LoggingEvent using LoadDC, to obtain the correct content if the event was generated in a different thread.

Parameters
keymapped diagnostic context key value.
destthe string to be added to.
Returns
true if dest is changed.

◆ getMDCCopy()

void log4cxx::spi::LoggingEvent::getMDCCopy ( ) const

Obtain a copy of the current thread's diagnostic context data.

◆ getMDCKeySet()

KeySet log4cxx::spi::LoggingEvent::getMDCKeySet ( ) const

The keys in the mapped diagnostic context for the event.

Returns
the mapped diagnostic context keys.

◆ getMessage()

const LogString & log4cxx::spi::LoggingEvent::getMessage ( ) const

The message provided in the logging request.

◆ getNDC()

bool log4cxx::spi::LoggingEvent::getNDC ( LogString dest) const

Add the current nested diagnostic context to the end of dest.

The diagnostic context must have been loaded into this LoggingEvent using LoadDC, to obtain the correct content if the event was generated in a different thread.

Parameters
destthe string to be added to.
Returns
true if dest is changed.

◆ getProperty()

bool log4cxx::spi::LoggingEvent::getProperty ( const LogString key,
LogString dest 
) const

Append onto dest the value associated with the property key.

Parameters
keythe property name.
destthe string onto which to associated value is appended.
Returns
true if dest was changed.

◆ getPropertyKeySet()

KeySet log4cxx::spi::LoggingEvent::getPropertyKeySet ( ) const

The set of of the key values in the properties for the event.

Returns
the keys from properties in this event.

◆ getRenderedMessage()

const LogString & log4cxx::spi::LoggingEvent::getRenderedMessage ( ) const

The message provided in the logging request.

◆ getStartTime()

static log4cxx_time_t log4cxx::spi::LoggingEvent::getStartTime ( )
static

The number of microseconds elapsed since 1970-01-01 at the time the application started.

◆ getThreadName()

const LogString & log4cxx::spi::LoggingEvent::getThreadName ( ) const

The identity of the thread in which this logging event was created.

◆ getThreadUserName()

const LogString & log4cxx::spi::LoggingEvent::getThreadUserName ( ) const

The name you gave to the thread in which this logging event was created.

You can create a named thread using log4cxx::helpers::ThreadUtility::createThread. If Log4cxx is unable to retrieve the thread name using a platform-specific call, the value is the same as the thread identity.

◆ getTimeStamp()

log4cxx_time_t log4cxx::spi::LoggingEvent::getTimeStamp ( ) const

The number of microseconds elapsed since 1970-01-01 at the time this logging event was created.

◆ LoadDC()

void log4cxx::spi::LoggingEvent::LoadDC ( ) const

Obtain a copy of the current thread's diagnostic context data.

The diagnostic context must be loaded to ensure the correct diagnostic context data is available when the event is stored for later use (for example, when the appender uses a different thread to process this event).

◆ setProperty()

void log4cxx::spi::LoggingEvent::setProperty ( const LogString key,
const LogString value 
)

Associate value with the property key.


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