Apache Log4cxx Version 1.1.0
|
The internal representation of logging events. More...
#include <loggingevent.h>
Public Types | |
typedef spi::KeySet | KeySet |
Public Member Functions | |
LoggingEvent () | |
For serialization only. | |
LoggingEvent (const LogString &logger, const LevelPtr &level, const LogString &message, const log4cxx::spi::LocationInfo &location) | |
Instantiate a LoggingEvent from the supplied parameters. | |
~LoggingEvent () | |
const LevelPtr & | getLevel () const |
Return the level of this event. | |
const LogString & | getLoggerName () const |
Return the name of the logger. | |
const LogString & | getMessage () const |
Return the message for this logging event. | |
const LogString & | getRenderedMessage () const |
Return the message for this logging event. | |
const LogString & | getThreadName () const |
Return the threadName of this event. | |
const LogString & | getThreadUserName () const |
Get the user name of the thread. | |
log4cxx_time_t | getTimeStamp () const |
The number of microseconds elapsed from 01.01.1970 until logging event was created. | |
std::chrono::time_point< std::chrono::system_clock > | getChronoTimeStamp () const |
const log4cxx::spi::LocationInfo & | getLocationInformation () const |
bool | getNDC (LogString &dest) const |
This method appends the NDC for this event to passed string. | |
bool | getMDC (const LogString &key, LogString &dest) const |
Appends the the context corresponding to the key parameter. | |
KeySet | getMDCKeySet () const |
Returns the set of of the key values in the MDC for the event. | |
void | getMDCCopy () const |
Obtain a copy of this thread's MDC prior to serialization or asynchronous logging. | |
bool | getProperty (const LogString &key, LogString &dest) const |
Return a previously set property. | |
KeySet | getPropertyKeySet () const |
Returns the set of of the key values in the properties for the event. | |
void | setProperty (const LogString &key, const LogString &value) |
Set a string property using a key and a string value. | |
Public Member Functions inherited from log4cxx::helpers::Object | |
virtual | ~Object () |
virtual const helpers::Class & | getClass () 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 () |
Returns the time when the application started, in microseconds elapsed since 01.01.1970. | |
The internal representation of logging events.
When an affirmative decision is made to log then a LoggingEvent
instance is created. This instance is passed around to the different log4cxx components.
This class is of concern to those wishing to extend log4cxx.
typedef spi::KeySet log4cxx::spi::LoggingEvent::KeySet |
log4cxx::spi::LoggingEvent::LoggingEvent | ( | ) |
For serialization only.
log4cxx::spi::LoggingEvent::LoggingEvent | ( | const LogString & | logger, |
const LevelPtr & | level, | ||
const LogString & | message, | ||
const log4cxx::spi::LocationInfo & | location | ||
) |
Instantiate a LoggingEvent from the supplied parameters.
Except timeStamp all the other fields of LoggingEvent
are filled when actually needed.
logger | The logger of this event. |
level | The level of this event. |
message | The message of this event. |
location | location of logging request. |
log4cxx::spi::LoggingEvent::~LoggingEvent | ( | ) |
std::chrono::time_point< std::chrono::system_clock > log4cxx::spi::LoggingEvent::getChronoTimeStamp | ( | ) | const |
const LevelPtr & log4cxx::spi::LoggingEvent::getLevel | ( | ) | const |
Return the level of this event.
const log4cxx::spi::LocationInfo & log4cxx::spi::LoggingEvent::getLocationInformation | ( | ) | const |
const LogString & log4cxx::spi::LoggingEvent::getLoggerName | ( | ) | const |
Return the name of the logger.
Appends the the context corresponding to the key
parameter.
If there is a local MDC copy, possibly because we are in a logging server or running inside AsyncAppender, then we search for the key in MDC copy, if a value is found it is returned. Otherwise, if the search in MDC copy returns an empty result, then the current thread's MDC
is used.
Note that both the local MDC copy and the current thread's MDC are searched.
key | key. |
dest | string to which value, if any, is appended. |
void log4cxx::spi::LoggingEvent::getMDCCopy | ( | ) | const |
Obtain a copy of this thread's MDC prior to serialization or asynchronous logging.
KeySet log4cxx::spi::LoggingEvent::getMDCKeySet | ( | ) | const |
const LogString & log4cxx::spi::LoggingEvent::getMessage | ( | ) | const |
Return the message for this logging event.
bool log4cxx::spi::LoggingEvent::getNDC | ( | LogString & | dest | ) | const |
Return a previously set property.
key | key. |
dest | string to which value, if any, is appended. |
KeySet log4cxx::spi::LoggingEvent::getPropertyKeySet | ( | ) | const |
Returns the set of of the key values in the properties for the event.
The returned set is unmodifiable by the caller.
const LogString & log4cxx::spi::LoggingEvent::getRenderedMessage | ( | ) | const |
Return the message for this logging event.
|
static |
Returns the time when the application started, in microseconds elapsed since 01.01.1970.
const LogString & log4cxx::spi::LoggingEvent::getThreadName | ( | ) | const |
Return the threadName of this event.
const LogString & log4cxx::spi::LoggingEvent::getThreadUserName | ( | ) | const |
Get the user name of the thread.
The default name is (noname) if Log4cxx is unable to retrieve the name using a platform-specific call.
log4cxx_time_t log4cxx::spi::LoggingEvent::getTimeStamp | ( | ) | const |
The number of microseconds elapsed from 01.01.1970 until logging event was created.
Set a string property using a key and a string value.
since 1.3