Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
log4cxx::helpers::FileWatchdog Class Reference

A monitor that will periodically check if a nominated file has changed and call the doOnChange virtual method if it has. More...

#include <filewatchdog.h>

Public Member Functions

virtual ~FileWatchdog ()
FileWatchdogPtr getSharedPtr ()
 A shareable pointer to this.
spi::ConfigurationStatus getStatus ()
 The result from the most recent call to spi::Configurator::doConfigure.
void setDelay (long millisecondDelay)
 Wait millisecondDelay between each check for file changes.
void setFile (const File &filename)
 Change the watched file to filename.
void start ()
 Call checkAndConfigure() and then add an asynchronous task that periodically checks for a modification to file().
void stop ()
 Stop the task that periodically checks for a file change.
bool is_active ()
 Is the task that periodically checks for a file change running?

Static Public Member Functions

static void stopAll ()
 Stop all tasks that periodically check for a file change.
static auto startWatching (const File &filename, const spi::ConfiguratorPtr &processor, const spi::LoggerRepositoryPtr &target, long millisecondDelay) -> spi::ConfigurationStatus
 Call start() on a monitor of filename that uses processor to configure target.

Static Public Attributes

static long DEFAULT_DELAY
 The default delay between every file modification check, set to 60 seconds.

Protected Member Functions

 FileWatchdog (const File &filename, const spi::ConfiguratorPtr &processor={}, const spi::LoggerRepositoryPtr &target={})
 Monitors filename and optionally uses processor to configure target.
virtual void doOnChange ()
 Call spi::Configurator::doConfigure if a processor has been provided.
void checkAndConfigure ()
 Call doOnChange() if the watched file has changed.
const File & file ()
 The watched file.

Detailed Description

A monitor that will periodically check if a nominated file has changed and call the doOnChange virtual method if it has.

Constructor & Destructor Documentation

◆ ~FileWatchdog()

virtual log4cxx::helpers::FileWatchdog::~FileWatchdog ( )
virtual

◆ FileWatchdog()

log4cxx::helpers::FileWatchdog::FileWatchdog ( const File & filename,
const spi::ConfiguratorPtr & processor = {},
const spi::LoggerRepositoryPtr & target = {} )
protected

Monitors filename and optionally uses processor to configure target.

Member Function Documentation

◆ checkAndConfigure()

void log4cxx::helpers::FileWatchdog::checkAndConfigure ( )
protected

Call doOnChange() if the watched file has changed.

◆ doOnChange()

virtual void log4cxx::helpers::FileWatchdog::doOnChange ( )
protectedvirtual

Call spi::Configurator::doConfigure if a processor has been provided.

◆ file()

const File & log4cxx::helpers::FileWatchdog::file ( )
protected

The watched file.

◆ getSharedPtr()

FileWatchdogPtr log4cxx::helpers::FileWatchdog::getSharedPtr ( )

A shareable pointer to this.

◆ getStatus()

spi::ConfigurationStatus log4cxx::helpers::FileWatchdog::getStatus ( )

The result from the most recent call to spi::Configurator::doConfigure.

◆ is_active()

bool log4cxx::helpers::FileWatchdog::is_active ( )

Is the task that periodically checks for a file change running?

◆ setDelay()

void log4cxx::helpers::FileWatchdog::setDelay ( long millisecondDelay)

Wait millisecondDelay between each check for file changes.

◆ setFile()

void log4cxx::helpers::FileWatchdog::setFile ( const File & filename)

Change the watched file to filename.

◆ start()

void log4cxx::helpers::FileWatchdog::start ( )

Call checkAndConfigure() and then add an asynchronous task that periodically checks for a modification to file().

◆ startWatching()

auto log4cxx::helpers::FileWatchdog::startWatching ( const File & filename,
const spi::ConfiguratorPtr & processor,
const spi::LoggerRepositoryPtr & target,
long millisecondDelay ) -> spi::ConfigurationStatus
static

Call start() on a monitor of filename that uses processor to configure target.

◆ stop()

void log4cxx::helpers::FileWatchdog::stop ( )

Stop the task that periodically checks for a file change.

◆ stopAll()

void log4cxx::helpers::FileWatchdog::stopAll ( )
static

Stop all tasks that periodically check for a file change.

Member Data Documentation

◆ DEFAULT_DELAY

long log4cxx::helpers::FileWatchdog::DEFAULT_DELAY
static

The default delay between every file modification check, set to 60 seconds.


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