blocxx
BLOCXX_NAMESPACE::MultiProcessFileAppender Class Reference

This class sends log messges to a file, for use when there may be multiple processes logging to the same file. More...

#include <MultiProcessFileAppender.hpp>

Inheritance diagram for BLOCXX_NAMESPACE::MultiProcessFileAppender:
BLOCXX_NAMESPACE::LogAppender BLOCXX_NAMESPACE::IntrusiveCountableBase

Public Member Functions

 MultiProcessFileAppender (const StringArray &components, const StringArray &categories, const String &filename, const String &pattern, UInt64 maxFileSize, UInt32 maxBackupIndex)
 All processes that log to filename must use the same values for maxFileSize and maxBackupIndex.
 
virtual ~MultiProcessFileAppender ()
 
- Public Member Functions inherited from BLOCXX_NAMESPACE::LogAppender
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 const unsigned int NO_MAX_LOG_SIZE = 0
 
- Static Public Attributes inherited from BLOCXX_NAMESPACE::LogAppender
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
 
- Protected Member Functions inherited from BLOCXX_NAMESPACE::LogAppender
 LogAppender (const StringArray &components=ALL_COMPONENTS, const StringArray &categories=ALL_CATEGORIES, const String &pattern=STR_TTCC_MESSAGE_FORMAT)
 
- Protected Member Functions inherited from BLOCXX_NAMESPACE::IntrusiveCountableBase
 IntrusiveCountableBase ()
 
 IntrusiveCountableBase (const IntrusiveCountableBase &)
 
IntrusiveCountableBaseoperator= (const IntrusiveCountableBase &)
 
virtual ~IntrusiveCountableBase ()
 

Private Attributes

String m_filename
 
UInt64 m_maxFileSize
 
unsigned m_maxBackupIndex
 
File m_log
 
File m_lock
 

Additional Inherited Members

- Static Public Member Functions inherited from BLOCXX_NAMESPACE::LogAppender
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.
 

Detailed Description

This class sends log messges to a file, for use when there may be multiple processes logging to the same file.

Definition at line 54 of file MultiProcessFileAppender.hpp.

Constructor & Destructor Documentation

◆ MultiProcessFileAppender()

BLOCXX_NAMESPACE::MultiProcessFileAppender::MultiProcessFileAppender ( const StringArray & components,
const StringArray & categories,
const String & filename,
const String & pattern,
UInt64 maxFileSize,
UInt32 maxBackupIndex )

◆ ~MultiProcessFileAppender()

BLOCXX_NAMESPACE::MultiProcessFileAppender::~MultiProcessFileAppender ( )
virtual

Definition at line 127 of file MultiProcessFileAppender.cpp.

Member Function Documentation

◆ doProcessLogMessage()

Member Data Documentation

◆ m_filename

String BLOCXX_NAMESPACE::MultiProcessFileAppender::m_filename
private

Definition at line 77 of file MultiProcessFileAppender.hpp.

Referenced by doProcessLogMessage(), and MultiProcessFileAppender().

◆ m_lock

File BLOCXX_NAMESPACE::MultiProcessFileAppender::m_lock
mutableprivate

Definition at line 81 of file MultiProcessFileAppender.hpp.

Referenced by doProcessLogMessage(), and MultiProcessFileAppender().

◆ m_log

File BLOCXX_NAMESPACE::MultiProcessFileAppender::m_log
mutableprivate

Definition at line 80 of file MultiProcessFileAppender.hpp.

Referenced by doProcessLogMessage(), and MultiProcessFileAppender().

◆ m_maxBackupIndex

unsigned BLOCXX_NAMESPACE::MultiProcessFileAppender::m_maxBackupIndex
private

Definition at line 79 of file MultiProcessFileAppender.hpp.

Referenced by doProcessLogMessage(), and MultiProcessFileAppender().

◆ m_maxFileSize

UInt64 BLOCXX_NAMESPACE::MultiProcessFileAppender::m_maxFileSize
private

Definition at line 78 of file MultiProcessFileAppender.hpp.

Referenced by doProcessLogMessage(), and MultiProcessFileAppender().

◆ NO_MAX_LOG_SIZE

const unsigned int BLOCXX_NAMESPACE::MultiProcessFileAppender::NO_MAX_LOG_SIZE = 0
static

Definition at line 57 of file MultiProcessFileAppender.hpp.


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