Apache log4cxx  Version 0.10.0
DOMConfigurator Class Reference

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

Inheritance diagram for DOMConfigurator:
Configurator ObjectImpl Object Object

Public Member Functions

 DOMConfigurator ()
 
 DOMConfigurator (log4cxx::helpers::Pool &p)
 
void addRef () const
 
void releaseRef () const
 
void doConfigure (const File &filename, spi::LoggerRepositoryPtr &repository)
 Interpret the XML file pointed by filename and set up log4cxx accordingly. More...
 
- Public Member Functions inherited from Configurator
 Configurator ()
 
- Public Member Functions inherited from Object
virtual const helpers::ClassgetClass () const
 
virtual ~Object ()
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 
- Public Member Functions inherited from ObjectImpl
 ObjectImpl ()
 
virtual ~ObjectImpl ()
 

Static Public Member Functions

static void configure (const std::string &filename)
 A static version of doConfigure. More...
 
static void configure (const std::wstring &filename)
 
static void configure (const std::basic_string< UniChar > &filename)
 
static void configure (const CFStringRef &filename)
 
static void configureAndWatch (const std::string &configFilename)
 Like configureAndWatch(const std::string& configFilename, long delay) except that the default delay as defined by log4cxx::helpers::FileWatchdog::DEFAULT_DELAY is used. More...
 
static void configureAndWatch (const std::wstring &configFilename)
 
static void configureAndWatch (const std::basic_string< UniChar > &configFilename)
 
static void configureAndWatch (const CFStringRef &configFilename)
 
static void configureAndWatch (const std::string &configFilename, long delay)
 Read the configuration file configFilename if it exists. More...
 
static void configureAndWatch (const std::wstring &configFilename, long delay)
 
static void configureAndWatch (const std::basic_string< UniChar > &configFilename, long delay)
 
static void configureAndWatch (const CFStringRef &configFilename, long delay)
 
- Static Public Member Functions inherited from Object
static const helpers::ClassgetStaticClass ()
 
static const log4cxx::helpers::ClassRegistrationregisterClass ()
 

Protected Types

typedef std::map< LogString, AppenderPtrAppenderMap
 

Protected Member Functions

AppenderPtr findAppenderByName (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *elem, apr_xml_doc *doc, const LogString &appenderName, AppenderMap &appenders)
 Used internally to parse appenders by IDREF name. More...
 
AppenderPtr findAppenderByReference (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *appenderRef, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to parse appenders by IDREF element. More...
 
AppenderPtr parseAppender (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *appenderElement, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to parse an appender element. More...
 
void parseErrorHandler (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *element, AppenderPtr &appender, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to parse an ErrorHandler element. More...
 
void parseFilters (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *element, std::vector< log4cxx::spi::FilterPtr > &filters)
 Used internally to parse a filter element. More...
 
void parseLogger (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *loggerElement, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to parse a logger element. More...
 
void parseLoggerFactory (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *factoryElement)
 Used internally to parse the logger factory element. More...
 
log4cxx::helpers::ObjectPtr parseTriggeringPolicy (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *factoryElement)
 Used internally to parse the logger factory element. More...
 
log4cxx::rolling::RollingPolicyPtr parseRollingPolicy (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *factoryElement)
 Used internally to parse the logger factory element. More...
 
void parseRoot (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *rootElement, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to parse the root logger element. More...
 
void parseChildrenOfLoggerElement (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *catElement, LoggerPtr logger, bool isRoot, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to parse the children of a logger element. More...
 
LayoutPtr parseLayout (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *layout_element)
 Used internally to parse a layout element. More...
 
void parseLevel (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *element, LoggerPtr logger, bool isRoot)
 Used internally to parse a level element. More...
 
void setParameter (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *elem, log4cxx::config::PropertySetter &propSetter)
 
void parse (log4cxx::helpers::Pool &p, log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *element, apr_xml_doc *doc, AppenderMap &appenders)
 Used internally to configure the log4cxx framework from an in-memory representation of an XML document. More...
 
LogString subst (const LogString &value)
 

Static Protected Member Functions

static LogString getAttribute (log4cxx::helpers::CharsetDecoderPtr &utf8Decoder, apr_xml_elem *, const std::string &attrName)
 

Protected Attributes

helpers::Properties props
 
spi::LoggerRepositoryPtr repository
 
spi::LoggerFactoryPtr loggerFactory
 
- Protected Attributes inherited from ObjectImpl
unsigned int volatile ref
 

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.

Member Typedef Documentation

typedef std::map<LogString, AppenderPtr> AppenderMap
protected

Constructor & Destructor Documentation

Member Function Documentation

void addRef ( ) const
virtual

Reimplemented from ObjectImpl.

static void configure ( const std::string &  filename)
static

A static version of doConfigure.

static void configure ( const std::wstring &  filename)
static
static void configure ( const std::basic_string< UniChar > &  filename)
static
static void configure ( const CFStringRef filename)
static
static void configureAndWatch ( const std::string &  configFilename)
static

Like configureAndWatch(const std::string& configFilename, long delay) except that the default delay as defined by log4cxx::helpers::FileWatchdog::DEFAULT_DELAY is used.

Parameters
configFilenameA log4j configuration file in XML format.
static void configureAndWatch ( const std::wstring &  configFilename)
static
static void configureAndWatch ( const std::basic_string< UniChar > &  configFilename)
static
static void configureAndWatch ( const CFStringRef configFilename)
static
static void configureAndWatch ( const std::string &  configFilename,
long  delay 
)
static

Read the configuration file configFilename if it exists.

Moreover, a thread will be created that will periodically check if configFilename has been created or modified. The period is determined by the delay argument. If a change or file creation is detected, then configFilename is read to configure log4cxx.

Parameters
configFilenameA log4j configuration file in XML format.
delayThe delay in milliseconds to wait between each check.
static void configureAndWatch ( const std::wstring &  configFilename,
long  delay 
)
static
static void configureAndWatch ( const std::basic_string< UniChar > &  configFilename,
long  delay 
)
static
static void configureAndWatch ( const CFStringRef configFilename,
long  delay 
)
static
void doConfigure ( const File filename,
spi::LoggerRepositoryPtr repository 
)
virtual

Interpret the XML file pointed by filename and set up log4cxx accordingly.

The configuration is done relative to the hierarchy parameter.

Parameters
filenameThe file to parse.
repositoryThe hierarchy to operation upon.

Implements Configurator.

AppenderPtr findAppenderByName ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  elem,
apr_xml_doc *  doc,
const LogString appenderName,
AppenderMap appenders 
)
protected

Used internally to parse appenders by IDREF name.

AppenderPtr findAppenderByReference ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  appenderRef,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to parse appenders by IDREF element.

static LogString getAttribute ( log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  ,
const std::string &  attrName 
)
staticprotected
void parse ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  element,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to configure the log4cxx framework from an in-memory representation of an XML document.

AppenderPtr parseAppender ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  appenderElement,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to parse an appender element.

void parseChildrenOfLoggerElement ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  catElement,
LoggerPtr  logger,
bool  isRoot,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to parse the children of a logger element.

void parseErrorHandler ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  element,
AppenderPtr appender,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to parse an ErrorHandler element.

void parseFilters ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  element,
std::vector< log4cxx::spi::FilterPtr > &  filters 
)
protected

Used internally to parse a filter element.

LayoutPtr parseLayout ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  layout_element 
)
protected

Used internally to parse a layout element.

void parseLevel ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  element,
LoggerPtr  logger,
bool  isRoot 
)
protected

Used internally to parse a level element.

void parseLogger ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  loggerElement,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to parse a logger element.

void parseLoggerFactory ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  factoryElement 
)
protected

Used internally to parse the logger factory element.

log4cxx::rolling::RollingPolicyPtr parseRollingPolicy ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  factoryElement 
)
protected

Used internally to parse the logger factory element.

void parseRoot ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  rootElement,
apr_xml_doc *  doc,
AppenderMap appenders 
)
protected

Used internally to parse the root logger element.

log4cxx::helpers::ObjectPtr parseTriggeringPolicy ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  factoryElement 
)
protected

Used internally to parse the logger factory element.

void releaseRef ( ) const
virtual

Reimplemented from ObjectImpl.

void setParameter ( log4cxx::helpers::Pool p,
log4cxx::helpers::CharsetDecoderPtr &  utf8Decoder,
apr_xml_elem *  elem,
log4cxx::config::PropertySetter propSetter 
)
protected
LogString subst ( const LogString value)
protected

Member Data Documentation

spi::LoggerFactoryPtr loggerFactory
protected
helpers::Properties props
protected
spi::LoggerRepositoryPtr repository
protected

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