BLOCXX_NAMESPACE::LogAppender Class Reference

#include <LogAppender.hpp>

Inheritance diagram for BLOCXX_NAMESPACE::LogAppender:

BLOCXX_NAMESPACE::IntrusiveCountableBase BLOCXX_NAMESPACE::CerrAppender BLOCXX_NAMESPACE::FileAppender BLOCXX_NAMESPACE::NullAppender BLOCXX_NAMESPACE::SyslogAppender

List of all members.

Public Member Functions

virtual ~LogAppender ()
void logMessage (const LogMessage &message) const
 Log a message using the specified component and category.
bool categoryIsEnabled (const String &category) const
bool componentAndCategoryAreEnabled (const String &component, const String &category) const
ELogLevel getLogLevel () const

Static Public Member Functions

static LogAppenderRef createLogAppender (const String &name, const StringArray &components, const StringArray &categories, const String &messageFormat, const String &type, const LoggerConfigMap &configItems)
 Create a concrete log appender depending on the type string passed in.

Static Public Attributes

static const char *const LOG_1_LOCATION_opt = "log.%1.location"
static const char *const LOG_1_MAX_FILE_SIZE_opt = "log.%1.max_file_size"
static const char *const LOG_1_MAX_BACKUP_INDEX_opt = "log.%1.max_backup_index"
static const char *const LOG_1_FLUSH_opt = "log.%1.flush"
static const char *const LOG_1_SYSLOG_IDENTITY_opt = "log.%1.identity"
static const char *const LOG_1_SYSLOG_FACILITY_opt = "log.%1.facility"
static const StringArray ALL_COMPONENTS
 Pass to createLogAppender to indicate all components.
static const StringArray ALL_CATEGORIES
 Pass to createLogAppender to indicate all categories.
static const String STR_TTCC_MESSAGE_FORMAT
 The Log4j TTCC message format - TTCC is acronym for Time Thread Category Component.
static const String TYPE_SYSLOG
 String of the type of the syslog log appender.
static const String TYPE_STDERR
 String of the type of the stderr log appender.
static const String TYPE_FILE
 String of the type of the file log appender.
static const String TYPE_NULL
 String of the type of the null log appender.

Protected Member Functions

 LogAppender (const StringArray &components, const StringArray &categories, const String &pattern)

Private Member Functions

virtual void doProcessLogMessage (const String &formattedMessage, const LogMessage &message) const =0

Private Attributes

SortedVectorSet< Stringm_components
bool m_allComponents
SortedVectorSet< Stringm_categories
bool m_allCategories
LogMessagePatternFormatter m_formatter


Detailed Description

Definition at line 72 of file LogAppender.hpp.


Constructor & Destructor Documentation

BLOCXX_NAMESPACE::LogAppender::~LogAppender (  )  [virtual]

Definition at line 97 of file LogAppender.cpp.

BLOCXX_NAMESPACE::LogAppender::LogAppender ( const StringArray components,
const StringArray categories,
const String pattern 
) [protected]

Definition at line 75 of file LogAppender.cpp.

References m_allCategories, m_allComponents, m_categories, and m_components.


Member Function Documentation

void BLOCXX_NAMESPACE::LogAppender::logMessage ( const LogMessage message  )  const

Log a message using the specified component and category.

Parameters:
message The message to log

Definition at line 86 of file LogAppender.cpp.

References BLOCXX_NAMESPACE::LogMessage::category, BLOCXX_NAMESPACE::LogMessage::component, componentAndCategoryAreEnabled(), doProcessLogMessage(), BLOCXX_NAMESPACE::LogMessagePatternFormatter::formatMessage(), m_formatter, and BLOCXX_NAMESPACE::StringBuffer::releaseString().

bool BLOCXX_NAMESPACE::LogAppender::categoryIsEnabled ( const String category  )  const

Definition at line 103 of file LogAppender.cpp.

References m_allCategories, and m_categories.

Referenced by componentAndCategoryAreEnabled(), and getLogLevel().

bool BLOCXX_NAMESPACE::LogAppender::componentAndCategoryAreEnabled ( const String component,
const String category 
) const

Definition at line 110 of file LogAppender.cpp.

References categoryIsEnabled(), m_allComponents, and m_components.

Referenced by logMessage().

ELogLevel BLOCXX_NAMESPACE::LogAppender::getLogLevel (  )  const

Definition at line 118 of file LogAppender.cpp.

References BLOCXX_ASSERTMSG, categoryIsEnabled(), BLOCXX_NAMESPACE::E_DEBUG_LEVEL, BLOCXX_NAMESPACE::E_ERROR_LEVEL, BLOCXX_NAMESPACE::E_FATAL_ERROR_LEVEL, BLOCXX_NAMESPACE::E_INFO_LEVEL, m_allCategories, m_categories, BLOCXX_NAMESPACE::Logger::STR_DEBUG_CATEGORY, BLOCXX_NAMESPACE::Logger::STR_ERROR_CATEGORY, BLOCXX_NAMESPACE::Logger::STR_FATAL_CATEGORY, and BLOCXX_NAMESPACE::Logger::STR_INFO_CATEGORY.

LogAppenderRef BLOCXX_NAMESPACE::LogAppender::createLogAppender ( const String name,
const StringArray components,
const StringArray categories,
const String messageFormat,
const String type,
const LoggerConfigMap configItems 
) [static]

Create a concrete log appender depending on the type string passed in.

If type == "syslog" a logger that writes to the syslog will be returned. If type == "" || type == "null" a logger that doesn't do anything will be returned. If type == "stderr" a logger that writes to stderr will be returned. Otherwise type is treated as a filename and a logger that writes to that file will be returned.

Parameters:
name The name of the logger to create
components The message components the logger will log. "*" means all components.
categories The message categories the logger will log. "*" means all categories.
messageFormat The message format pattern.
type The type of logger to create.
configItems Additional config items the logger may use for configuration.
Returns:
a class that implements the Logger interface.
Exceptions:
LoggerException - E_UNKNOWN_LOG_APPENDER_TYPE - if type is unkonwn.
  • E_INVALID_MAX_FILE_SIZE - if the max_file_size option is invalid
  • E_INVALID_MAX_BACKUP_INDEX - if the max_backup_index option is invalid

Definition at line 148 of file LogAppender.cpp.

References BLOCXX_DEFAULT_LOG_1_FLUSH, BLOCXX_DEFAULT_LOG_1_MAX_BACKUP_INDEX, BLOCXX_DEFAULT_LOG_1_MAX_FILE_SIZE, BLOCXX_DEFAULT_LOG_1_SYSLOG_FACILITY, BLOCXX_DEFAULT_LOG_1_SYSLOG_IDENTITY, BLOCXX_THROW_ERR, BLOCXX_THROW_ERR_SUBEX, BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::Logger::E_INVALID_MAX_BACKUP_INDEX, BLOCXX_NAMESPACE::Logger::E_INVALID_MAX_FILE_SIZE, BLOCXX_NAMESPACE::Logger::E_UNKNOWN_LOG_APPENDER_TYPE, BLOCXX_NAMESPACE::String::empty(), BLOCXX_NAMESPACE::String::equalsIgnoreCase(), BLOCXX_NAMESPACE::Logger::getConfigItem(), BLOCXX_NAMESPACE::Exception::getMessage(), LOG_1_FLUSH_opt, LOG_1_LOCATION_opt, LOG_1_MAX_BACKUP_INDEX_opt, LOG_1_MAX_FILE_SIZE_opt, LOG_1_SYSLOG_FACILITY_opt, LOG_1_SYSLOG_IDENTITY_opt, BLOCXX_NAMESPACE::String::toUInt64(), BLOCXX_NAMESPACE::String::toUnsignedInt(), TYPE_FILE, TYPE_NULL, TYPE_STDERR, and TYPE_SYSLOG.

virtual void BLOCXX_NAMESPACE::LogAppender::doProcessLogMessage ( const String formattedMessage,
const LogMessage message 
) const [private, pure virtual]

Implemented in BLOCXX_NAMESPACE::CerrAppender, BLOCXX_NAMESPACE::FileAppender, BLOCXX_NAMESPACE::NullAppender, and BLOCXX_NAMESPACE::SyslogAppender.

Referenced by logMessage().


Member Data Documentation

const char *const BLOCXX_NAMESPACE::LogAppender::LOG_1_LOCATION_opt = "log.%1.location" [static]

Definition at line 77 of file LogAppender.hpp.

Referenced by createLogAppender().

const char *const BLOCXX_NAMESPACE::LogAppender::LOG_1_MAX_FILE_SIZE_opt = "log.%1.max_file_size" [static]

Definition at line 78 of file LogAppender.hpp.

Referenced by createLogAppender().

const char *const BLOCXX_NAMESPACE::LogAppender::LOG_1_MAX_BACKUP_INDEX_opt = "log.%1.max_backup_index" [static]

Definition at line 79 of file LogAppender.hpp.

Referenced by createLogAppender().

const char *const BLOCXX_NAMESPACE::LogAppender::LOG_1_FLUSH_opt = "log.%1.flush" [static]

Definition at line 80 of file LogAppender.hpp.

Referenced by createLogAppender().

const char *const BLOCXX_NAMESPACE::LogAppender::LOG_1_SYSLOG_IDENTITY_opt = "log.%1.identity" [static]

Definition at line 81 of file LogAppender.hpp.

Referenced by createLogAppender().

const char *const BLOCXX_NAMESPACE::LogAppender::LOG_1_SYSLOG_FACILITY_opt = "log.%1.facility" [static]

Definition at line 82 of file LogAppender.hpp.

Referenced by createLogAppender().

const StringArray BLOCXX_NAMESPACE::LogAppender::ALL_COMPONENTS [static]

Pass to createLogAppender to indicate all components.

Definition at line 130 of file LogAppender.hpp.

const StringArray BLOCXX_NAMESPACE::LogAppender::ALL_CATEGORIES [static]

Pass to createLogAppender to indicate all categories.

Definition at line 132 of file LogAppender.hpp.

const String BLOCXX_NAMESPACE::LogAppender::STR_TTCC_MESSAGE_FORMAT [static]

The Log4j TTCC message format - TTCC is acronym for Time Thread Category Component.

"%r [%t] %-5p %c - %m"

Definition at line 135 of file LogAppender.hpp.

const String BLOCXX_NAMESPACE::LogAppender::TYPE_SYSLOG [static]

String of the type of the syslog log appender.

Definition at line 137 of file LogAppender.hpp.

Referenced by createLogAppender().

const String BLOCXX_NAMESPACE::LogAppender::TYPE_STDERR [static]

String of the type of the stderr log appender.

Definition at line 139 of file LogAppender.hpp.

Referenced by createLogAppender().

const String BLOCXX_NAMESPACE::LogAppender::TYPE_FILE [static]

String of the type of the file log appender.

Definition at line 141 of file LogAppender.hpp.

Referenced by createLogAppender().

const String BLOCXX_NAMESPACE::LogAppender::TYPE_NULL [static]

String of the type of the null log appender.

Definition at line 143 of file LogAppender.hpp.

Referenced by createLogAppender().

SortedVectorSet<String> BLOCXX_NAMESPACE::LogAppender::m_components [private]

Definition at line 153 of file LogAppender.hpp.

Referenced by componentAndCategoryAreEnabled(), and LogAppender().

bool BLOCXX_NAMESPACE::LogAppender::m_allComponents [private]

Definition at line 154 of file LogAppender.hpp.

Referenced by componentAndCategoryAreEnabled(), and LogAppender().

SortedVectorSet<String> BLOCXX_NAMESPACE::LogAppender::m_categories [private]

Definition at line 155 of file LogAppender.hpp.

Referenced by categoryIsEnabled(), getLogLevel(), and LogAppender().

bool BLOCXX_NAMESPACE::LogAppender::m_allCategories [private]

Definition at line 156 of file LogAppender.hpp.

Referenced by categoryIsEnabled(), getLogLevel(), and LogAppender().

LogMessagePatternFormatter BLOCXX_NAMESPACE::LogAppender::m_formatter [private]

Definition at line 158 of file LogAppender.hpp.

Referenced by logMessage().


The documentation for this class was generated from the following files:
Generated on Fri Sep 21 23:42:37 2007 for blocxx by  doxygen 1.5.3