log4cplus_TimeBasedRollingFileAppender(3)

log4cplus::TimeBasedRollingFileAppender(3) log4cplus log4cplus::TimeBasedRollingFileAppender(3)

NAME

log4cplus::TimeBasedRollingFileAppender - TimeBasedRollingFileAppender extends FileAppenderBase so that the underlying file is rolled over at a user chosen frequency while also keeping in check a total maximum number of produced files.

SYNOPSIS

#include <fileappender.h>

Inherits log4cplus::FileAppenderBase.

Public Member Functions


TimeBasedRollingFileAppender (const tstring &filename=LOG4CPLUS_TEXT(''), const tstring &filenamePattern=LOG4CPLUS_TEXT('%d.log'), int maxHistory=10, bool cleanHistoryOnStart=false, bool immediateFlush=true, bool createDirs=false, bool rollOnClose=true)
TimeBasedRollingFileAppender (const helpers::Properties &properties)
~TimeBasedRollingFileAppender ()

Protected Member Functions


void append (const spi::InternalLoggingEvent &event)
Subclasses of Appender should implement this method to perform actual logging. void open (std::ios_base::openmode mode)
void close ()
Release any resources allocated within the appender such as file handles, network connections, etc. void rollover (bool alreadyLocked=false)
void clean (helpers::Time time)
helpers::Time::duration getRolloverPeriodDuration () const
helpers::Time calculateNextRolloverTime (const helpers::Time &t) const

Protected Attributes


tstring filenamePattern
DailyRollingFileSchedule schedule
tstring scheduledFilename
int maxHistory
bool cleanHistoryOnStart
log4cplus::helpers::Time lastHeartBeat
log4cplus::helpers::Time nextRolloverTime
bool rollOnClose

Additional Inherited Members

Detailed Description

TimeBasedRollingFileAppender extends FileAppenderBase so that the underlying file is rolled over at a user chosen frequency while also keeping in check a total maximum number of produced files.

Properties

Properties additional to FileAppenderBase's properties:

FilenamePattern
The mandatory fileNamePattern property defines the name of the rolled-over (archived) log files. Its value should consist of the name of the file, plus a suitably placed d conversion specifier. The d conversion specifier may contain a date-and-time pattern as specified by the java's SimpleDateFormat. The rollover period is inferred from the value of fileNamePattern.
MaxHistory
The optional maxHistory property controls the maximum number of archive files to keep, deleting older files.
CleanHistoryOnStart
If set to true, archive removal will be executed on appender start up. By default this property is set to false.
RollOnClose
This property specifies whether to rollover log files upon shutdown. By default it's set to true to retain compatibility with legacy code, however it may lead to undesired behaviour as described in the github issue #120.

Definition at line 385 of file fileappender.h.

Constructor & Destructor Documentation

log4cplus::TimeBasedRollingFileAppender::TimeBasedRollingFileAppender (const tstring & filename = LOG4CPLUS_TEXT(''), const tstring & filenamePattern = LOG4CPLUS_TEXT('%d.log'), int maxHistory = 10, bool cleanHistoryOnStart = false, bool immediateFlush = true, bool createDirs = false, bool rollOnClose = true)

log4cplus::TimeBasedRollingFileAppender::TimeBasedRollingFileAppender (const helpers::Properties & properties)

log4cplus::TimeBasedRollingFileAppender::~TimeBasedRollingFileAppender ()

Member Function Documentation

void log4cplus::TimeBasedRollingFileAppender::append (const spi::InternalLoggingEvent & event) [protected], [virtual]

Subclasses of Appender should implement this method to perform actual logging.

See also

doAppend method.

Reimplemented from log4cplus::FileAppenderBase.

helpers::Time log4cplus::TimeBasedRollingFileAppender::calculateNextRolloverTime (const helpers::Time & t) const [protected]

void log4cplus::TimeBasedRollingFileAppender::clean (helpers::Time time) [protected]

void log4cplus::TimeBasedRollingFileAppender::close () [protected], [virtual]

Release any resources allocated within the appender such as file handles, network connections, etc. It is a programming error to append to a closed appender.

Reimplemented from log4cplus::FileAppenderBase.

helpers::Time::duration log4cplus::TimeBasedRollingFileAppender::getRolloverPeriodDuration () const [protected]

void log4cplus::TimeBasedRollingFileAppender::open (std::ios_base::openmode mode) [protected], [virtual]

Reimplemented from log4cplus::FileAppenderBase.

void log4cplus::TimeBasedRollingFileAppender::rollover (bool alreadyLocked = false) [protected]

Member Data Documentation

bool log4cplus::TimeBasedRollingFileAppender::cleanHistoryOnStart [protected]

Definition at line 414 of file fileappender.h.

tstring log4cplus::TimeBasedRollingFileAppender::filenamePattern [protected]

Definition at line 410 of file fileappender.h.

log4cplus::helpers::Time log4cplus::TimeBasedRollingFileAppender::lastHeartBeat [protected]

Definition at line 415 of file fileappender.h.

int log4cplus::TimeBasedRollingFileAppender::maxHistory [protected]

Definition at line 413 of file fileappender.h.

log4cplus::helpers::Time log4cplus::TimeBasedRollingFileAppender::nextRolloverTime [protected]

Definition at line 416 of file fileappender.h.

bool log4cplus::TimeBasedRollingFileAppender::rollOnClose [protected]

Definition at line 417 of file fileappender.h.

DailyRollingFileSchedule log4cplus::TimeBasedRollingFileAppender::schedule [protected]

Definition at line 411 of file fileappender.h.

tstring log4cplus::TimeBasedRollingFileAppender::scheduledFilename [protected]

Definition at line 412 of file fileappender.h.

Author

Generated automatically by Doxygen for log4cplus from the source code.

Fri Jun 18 2021 Version 2.0.6