Log4j Version 1.2.14: Class DOMConfigurator

Log4j 1.2

Log4j 1.2.14

org.apache.log4j.xml Class DOMConfigurator

java.lang.Object
  |
  +--org.apache.log4j.xml.DOMConfigurator
All Implemented Interfaces:
Configurator

public class DOMConfigurator
extends Object
implements Configurator

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

The DTD is specified in log4j.dtd.

Sometimes it is useful to see how log4j is reading configuration files. You can enable log4j internal logging by defining the log4j.debug variable on the java command line. Alternatively, set the debug attribute in the log4j:configuration 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.

Since:
0.8.3
Author:
Christopher Taylor, Ceki Gülcü, Anders Kristensen

 
 
static void
static void
static void
static void
static void
 void
protected  void
 void
 void
 void
 void
protected  Appender
protected  Appender
protected  void
protected  Appender
protected  void
protected  void
protected  void
protected  void
protected  void
protected  Layout
protected  void
protected  void
protected  void
protected  void
protected  String
 
 

DOMConfigurator

public DOMConfigurator()
No argument constructor.

findAppenderByName

protected Appender findAppenderByName(Document doc,
                                      String appenderName)
Used internally to parse appenders by IDREF name.

findAppenderByReference

protected Appender findAppenderByReference(Element appenderRef)
Used internally to parse appenders by IDREF element.

parseAppender

protected Appender parseAppender(Element appenderElement)
Used internally to parse an appender element.

parseErrorHandler

protected void parseErrorHandler(Element element,
                                 Appender appender)
Used internally to parse an ErrorHandler element.

parseFilters

protected void parseFilters(Element element,
                            Appender appender)
Used internally to parse a filter element.

parseCategory

protected void parseCategory(Element loggerElement)
Used internally to parse an category element.

parseCategoryFactory

protected void parseCategoryFactory(Element factoryElement)
Used internally to parse the category factory element.

parseRoot

protected void parseRoot(Element rootElement)
Used internally to parse the roor category element.

parseChildrenOfLoggerElement

protected void parseChildrenOfLoggerElement(Element catElement,
                                            Logger cat,
                                            boolean isRoot)
Used internally to parse the children of a category element.

parseLayout

protected Layout parseLayout(Element layout_element)
Used internally to parse a layout element.

parseRenderer

protected void parseRenderer(Element element)

parseLevel

protected void parseLevel(Element element,
                          Logger logger,
                          boolean isRoot)
Used internally to parse a level element.

setParameter

protected void setParameter(Element elem,
                            PropertySetter propSetter)

configure

public static void configure(Element element)
Configure log4j using a configuration element as defined in the log4j.dtd.

configureAndWatch

public static void configureAndWatch(String configFilename)
Like configureAndWatch(String, long) except that the default delay as defined by FileWatchdog.DEFAULT_DELAY is used.
Parameters:
configFilename - A log4j configuration file in XML format.

configureAndWatch

public static void configureAndWatch(String configFilename,
                                     long delay)
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 log4j.
Parameters:
configFilename - A log4j configuration file in XML format.
delay - The delay in milliseconds to wait between each check.

doConfigure

public void doConfigure(String filename,
                        LoggerRepository repository)

doConfigure

public void doConfigure(URL url,
                        LoggerRepository repository)
Description copied from interface: Configurator
Interpret a resource pointed by a URL and set up log4j accordingly. The configuration is done relative to the hierarchy parameter.
Specified by:
doConfigure in interface Configurator
Following copied from interface: org.apache.log4j.spi.Configurator
Parameters:
url - The URL to parse
repository - The hierarchy to operation upon.

doConfigure

public void doConfigure(InputStream inputStream,
                        LoggerRepository repository)
                 throws FactoryConfigurationError
Configure log4j by reading in a log4j.dtd compliant XML configuration file.

doConfigure

public void doConfigure(Reader reader,
                        LoggerRepository repository)
                 throws FactoryConfigurationError
Configure log4j by reading in a log4j.dtd compliant XML configuration file.

doConfigure

protected void doConfigure(InputSource inputSource,
                           LoggerRepository repository)
                    throws FactoryConfigurationError
Configure log4j by reading in a log4j.dtd compliant XML configuration file.

doConfigure

public void doConfigure(Element element,
                        LoggerRepository repository)
Configure by taking in an DOM element.

configure

public static void configure(String filename)
                      throws FactoryConfigurationError
A static version of doConfigure(String, LoggerRepository).

configure

public static void configure(URL url)
                      throws FactoryConfigurationError
A static version of doConfigure(URL, LoggerRepository).

parse

protected void parse(Element element)
Used internally to configure the log4j framework by parsing a DOM tree of XML elements based on log4j.dtd.

subst

protected String subst(String value)

Log4j 1.2.14

Copyright 2000-2005 Apache Software Foundation.