Apache Log4cxx Version 1.0.0
Loading...
Searching...
No Matches
log4cxx::rolling::SizeBasedTriggeringPolicy Class Reference

SizeBasedTriggeringPolicy looks at size of the file being currently written to. More...

#include <sizebasedtriggeringpolicy.h>

Inheritance diagram for log4cxx::rolling::SizeBasedTriggeringPolicy:
log4cxx::rolling::TriggeringPolicy log4cxx::spi::OptionHandler log4cxx::helpers::Object log4cxx::helpers::Object

Public Member Functions

 SizeBasedTriggeringPolicy ()
 
bool isTriggeringEvent (Appender *appender, const spi::LoggingEventPtr &event, const LogString &filename, size_t fileLength) override
 Determines if a rollover may be appropriate at this time.
 
size_t getMaxFileSize ()
 
void setMaxFileSize (size_t l)
 
void activateOptions (helpers::Pool &) override
 Activate the options that were previously set with calls to option setters.
 
void setOption (const LogString &option, const LogString &value) override
 Set option to value.
 
- Public Member Functions inherited from log4cxx::rolling::TriggeringPolicy
virtual ~TriggeringPolicy ()
 
virtual bool isTriggeringEvent (Appender *appender, const spi::LoggingEventPtr &event, const LogString &filename, size_t fileLength)=0
 Determines if a rollover may be appropriate at this time.
 
- Public Member Functions inherited from log4cxx::spi::OptionHandler
virtual ~OptionHandler ()
 
virtual void activateOptions (helpers::Pool &p)=0
 Activate the options that were previously set with calls to option setters.
 
virtual void setOption (const LogString &option, const LogString &value)=0
 Set option to value.
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual const helpers::ClassgetClass () const =0
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Protected Attributes

size_t maxFileSize
 

Detailed Description

SizeBasedTriggeringPolicy looks at size of the file being currently written to.

Constructor & Destructor Documentation

◆ SizeBasedTriggeringPolicy()

log4cxx::rolling::SizeBasedTriggeringPolicy::SizeBasedTriggeringPolicy ( )

Member Function Documentation

◆ activateOptions()

void log4cxx::rolling::SizeBasedTriggeringPolicy::activateOptions ( helpers::Pool p)
overridevirtual

Activate the options that were previously set with calls to option setters.

This allows to defer activiation of the options until all options have been set. This is required for components which have related options that remain ambigous until all are set.

For example, the FileAppender has the File and Append options both of which are ambigous until the other is also set.

Implements log4cxx::spi::OptionHandler.

◆ getMaxFileSize()

size_t log4cxx::rolling::SizeBasedTriggeringPolicy::getMaxFileSize ( )

◆ isTriggeringEvent()

bool log4cxx::rolling::SizeBasedTriggeringPolicy::isTriggeringEvent ( Appender appender,
const spi::LoggingEventPtr event,
const LogString filename,
size_t  fileLength 
)
overridevirtual

Determines if a rollover may be appropriate at this time.

If true is returned, RolloverPolicy.rollover will be called but it can determine that a rollover is not warranted.

Parameters
appenderA reference to the appender.
eventA reference to the currently event.
filenameThe filename for the currently active log file.
fileLengthLength of the file in bytes.
Returns
true if a rollover should occur.

Implements log4cxx::rolling::TriggeringPolicy.

◆ setMaxFileSize()

void log4cxx::rolling::SizeBasedTriggeringPolicy::setMaxFileSize ( size_t  l)

◆ setOption()

void log4cxx::rolling::SizeBasedTriggeringPolicy::setOption ( const LogString option,
const LogString value 
)
overridevirtual

Set option to value.

The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when activateOptions is called.

Implements log4cxx::spi::OptionHandler.

Member Data Documentation

◆ maxFileSize

size_t log4cxx::rolling::SizeBasedTriggeringPolicy::maxFileSize
protected

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