blocxx
|
This class sends log messges to a file. More...
#include <FileAppender.hpp>
Public Member Functions | |
FileAppender (const StringArray &components, const StringArray &categories, const char *filename, const String &pattern, UInt64 maxFileSize, unsigned int maxBackupIndex, bool flushLog=true) | |
virtual | ~FileAppender () |
![]() | |
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 Attributes | |
static UInt64 const | NO_MAX_LOG_SIZE = 0 |
static unsigned int const | NO_MAX_BACKUP_INDEX = 0 |
static const GlobalString | STR_DEFAULT_MESSAGE_PATTERN = { "%d{%a %b %d %H:%M:%S %Y} [%t]: %m", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
![]() | |
static const GlobalStringArray | ALL_COMPONENTS = { "*", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
Pass to createLogAppender to indicate all components. | |
static const GlobalStringArray | ALL_CATEGORIES = { "*", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
Pass to createLogAppender to indicate all categories. | |
static const GlobalString | STR_TTCC_MESSAGE_FORMAT = { "%r [%t] %-5p %c - %m", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
The Log4j TTCC message format - TTCC is acronym for Time Thread Category Component. | |
static const GlobalString | TYPE_SYSLOG = { "syslog", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
String of the type of the syslog log appender. | |
static const GlobalString | TYPE_STDERR = { "stderr", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
String of the type of the stderr log appender. | |
static const GlobalString | TYPE_FILE = { "file", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
String of the type of the file log appender. | |
static const GlobalString | TYPE_MPFILE = { "mpfile", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
String of the type of the multi-process file log appender. | |
static const GlobalString | TYPE_NULL = { "null", 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
String of the type of the null log appender. | |
Protected Member Functions | |
virtual void | doProcessLogMessage (const String &formattedMessage, const LogMessage &message) const |
![]() | |
LogAppender (const StringArray &components=ALL_COMPONENTS, const StringArray &categories=ALL_CATEGORIES, const String &pattern=STR_TTCC_MESSAGE_FORMAT) | |
![]() | |
IntrusiveCountableBase () | |
IntrusiveCountableBase (const IntrusiveCountableBase &) | |
IntrusiveCountableBase & | operator= (const IntrusiveCountableBase &) |
virtual | ~IntrusiveCountableBase () |
Private Attributes | |
String | m_filename |
UInt64 | m_maxFileSize |
unsigned int | m_maxBackupIndex |
std::ofstream | m_log |
bool | m_flushLog |
Additional Inherited Members | |
![]() | |
static LogAppenderRef | getCurrentLogAppender () |
Get a copy of the per thread LogAppenderRef or if not set, the default one. | |
static LogAppenderRef | getDefaultLogAppender () |
Returns a copy of default LogAppenderRef. | |
static bool | setDefaultLogAppender (const LogAppenderRef &ref) |
Set the default global LogAppenderRef. | |
static LogAppenderRef | getThreadLogAppender () |
Returns a copy of the thread LogAppenderRef. | |
static bool | setThreadLogAppender (const LogAppenderRef &ref) |
Set a per thread LogAppenderRef that overrides the default one. | |
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. | |
This class sends log messges to a file.
Definition at line 54 of file FileAppender.hpp.
BLOCXX_NAMESPACE::FileAppender::FileAppender | ( | const StringArray & | components, |
const StringArray & | categories, | ||
const char * | filename, | ||
const String & | pattern, | ||
UInt64 | maxFileSize, | ||
unsigned int | maxBackupIndex, | ||
bool | flushLog = true ) |
Definition at line 54 of file FileAppender.cpp.
References BLOCXX_THROW, BLOCXX_NAMESPACE::String::c_str(), m_filename, and m_log.
|
virtual |
Definition at line 75 of file FileAppender.cpp.
|
protectedvirtual |
Implements BLOCXX_NAMESPACE::LogAppender.
Definition at line 85 of file FileAppender.cpp.
References BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::FileSystem::exists(), i, BLOCXX_NAMESPACE::String::length(), m_filename, m_flushLog, m_log, m_maxBackupIndex, m_maxFileSize, NO_MAX_LOG_SIZE, BLOCXX_NAMESPACE::FileSystem::removeFile(), and BLOCXX_NAMESPACE::FileSystem::renameFile().
|
private |
Definition at line 74 of file FileAppender.hpp.
Referenced by doProcessLogMessage(), and FileAppender().
|
private |
Definition at line 78 of file FileAppender.hpp.
Referenced by doProcessLogMessage().
|
mutableprivate |
Definition at line 77 of file FileAppender.hpp.
Referenced by doProcessLogMessage(), and FileAppender().
|
private |
Definition at line 76 of file FileAppender.hpp.
Referenced by doProcessLogMessage().
|
private |
Definition at line 75 of file FileAppender.hpp.
Referenced by doProcessLogMessage().
|
static |
Definition at line 58 of file FileAppender.hpp.
|
static |
Definition at line 57 of file FileAppender.hpp.
Referenced by doProcessLogMessage().
|
static |
Definition at line 69 of file FileAppender.hpp.