Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
log4cxx::xml::DOMConfigurator Class Reference

Use this class to initialize the log4cxx environment using a DOM tree. More...

#include <domconfigurator.h>

Inheritance diagram for log4cxx::xml::DOMConfigurator:
log4cxx::spi::Configurator log4cxx::helpers::Object

Public Member Functions

 ~DOMConfigurator ()
 DOMConfigurator ()
spi::ConfigurationStatus doConfigure (const File &filename, const spi::LoggerRepositoryPtr &repository=spi::LoggerRepositoryPtr()) override
 Interpret filename as an XML file and set up Log4cxx accordingly.
Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
virtual const helpers::Class & getClass () const =0
virtual bool instanceof (const Class &clazz) const =0
virtual const void * cast (const Class &clazz) const =0

Static Public Member Functions

static spi::ConfigurationStatus configure (const File &configFilename)
 Read configuration options from configFilename.
static spi::ConfigurationStatus configureAndWatch (const File &configFilename, long delay=0)
 Read configuration options from configFilename (if it exists).
Static Public Member Functions inherited from log4cxx::spi::Configurator
static helpers::Properties & properties ()
 The key value pairs used when expanding ${varname} instances in a configuration file.

Additional Inherited Members

Protected Member Functions inherited from log4cxx::spi::Configurator
 Configurator ()

Detailed Description

Use this class to initialize the log4cxx environment using a DOM tree.

Sometimes it is useful to see how log4cxx is reading configuration files. You can enable log4cxx internal logging by setting the debug attribute in the log4cxx element. As in

        <log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/">
        ...
        </log4j:configuration>

There are sample XML files included in the package.

Constructor & Destructor Documentation

◆ ~DOMConfigurator()

log4cxx::xml::DOMConfigurator::~DOMConfigurator ( )

◆ DOMConfigurator()

log4cxx::xml::DOMConfigurator::DOMConfigurator ( )

Member Function Documentation

◆ configure()

spi::ConfigurationStatus log4cxx::xml::DOMConfigurator::configure ( const File & configFilename)
static

Read configuration options from configFilename.

Stores Logger instances in the spi::LoggerRepository held by LogManager.

◆ configureAndWatch()

spi::ConfigurationStatus log4cxx::xml::DOMConfigurator::configureAndWatch ( const File & configFilename,
long delay = 0 )
static

Read configuration options from configFilename (if it exists).

A thread will be created that periodically checks whether configFilename has been created or modified. A period of log4cxx::helpers::FileWatchdog::DEFAULT_DELAY is used if delay is not a positive number. If a change or file creation is detected, then configFilename is read to configure Log4cxx.

The thread will be stopped by a LogManager::shutdown call.

Parameters
configFilenameA XML format file.
delayThe delay in milliseconds to wait between each check.

◆ doConfigure()

spi::ConfigurationStatus log4cxx::xml::DOMConfigurator::doConfigure ( const File & filename,
const spi::LoggerRepositoryPtr & repository = spi::LoggerRepositoryPtr() )
overridevirtual

Interpret filename as an XML file and set up Log4cxx accordingly.

If repository is not provided, the spi::LoggerRepository held by LogManager is used. The existing configuration is not cleared nor reset. If you require a different behavior, call resetConfiguration before calling doConfigure.

Parameters
filenameThe file to parse.
repositoryWhere the Logger instances reside.

Implements log4cxx::spi::Configurator.


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