38#include "blocxx/BLOCXX_config.h"
46#ifdef BLOCXX_HAVE_SYS_STAT_H
55 using namespace blocxx;
63 m_ok = file.getLock() == 0;
84 typedef blocxx::MultiProcessFileAppender app_t;
86 UInt64 kbytesToBytes(UInt64 max_size)
88 UInt64
const oneK = 1024;
89 UInt64
const biggest = UInt64(-1);
91 max_size == app_t::NO_MAX_LOG_SIZE ? biggest
92 : max_size > biggest / oneK ? biggest
105 UInt32 maxBackupIndex
117 String msg =
"Cannot create log file " + filename;
122 String msg =
"Cannot create lock file for log file " + filename +
".lock";
147 UInt64 size =
m_log.size();
161 String s = formattedMessage +
"\n";
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
LogAppender(const StringArray &components=ALL_COMPONENTS, const StringArray &categories=ALL_CATEGORIES, const String &pattern=STR_TTCC_MESSAGE_FORMAT)
virtual ~MultiProcessFileAppender()
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 void doProcessLogMessage(const String &formattedMessage, const LogMessage &message) const
unsigned m_maxBackupIndex
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
BLOCXX_COMMON_API File openForAppendOrCreateFile(const String &path)
Opens the file for the given name to append data or create if it does not exist.
BLOCXX_COMMON_API bool removeFile(const String &path)
Remove the given file.
BLOCXX_COMMON_API bool renameFile(const String &oldFileName, const String &newFileName)
Rename the given file to the new name.
BLOCXX_COMMON_API File openOrCreateFile(const String &path)
Opens or creates the file for the given name.
Array< String > StringArray