org.jboss.logging.jdk.xml
Class DOMConfigurator

java.lang.Object
  extended by org.jboss.logging.jdk.xml.DOMConfigurator

public class DOMConfigurator
extends Object

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 jdk: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.

Version:
$Revision: 1.3 $
Author:
Christopher Taylor, Ceki Gülcü, Anders Kristensen, Scott.Stark@jboss.org

Constructor Summary
DOMConfigurator()
          No argument constructor.
DOMConfigurator(ErrorManager errorLog)
           
 
Method Summary
static void configure(Element element)
          Configure jdk using a configuration element as defined in the jdk.dtd.
static void configure(InputStream is)
          A static version of doConfigure(java.net.URL, LogManager).
static void configure(String filename)
          A static version of doConfigure(String, LogManager).
static void configure(URL url)
          A static version of doConfigure(java.net.URL, LogManager).
protected  void debug(String msg)
           
 void doConfigure(Element element, LogManager repository)
          Configure by taking in an DOM element.
protected  void doConfigure(InputSource inputSource, LogManager repository)
          Configure jdk by reading in a jdk.dtd compliant XML configuration file.
 void doConfigure(InputStream inputStream, LogManager repository)
          Configure jdk by reading in a jdk.dtd compliant XML configuration file.
 void doConfigure(Reader reader, LogManager repository)
          Configure jdk by reading in a jdk.dtd compliant XML configuration file.
 void doConfigure(String filename, LogManager repository)
           
 void doConfigure(URL url, LogManager repository)
           
protected  Handler findHandlerByName(Document doc, String appenderName)
          Used internally to parse appenders by IDREF name.
protected  Handler findHandlerByReference(Element appenderRef)
          Used internally to parse appenders by IDREF element.
protected  void parse(Element element)
          Used internally to configure the jdk framework by parsing a DOM tree of XML elements based on jdk.dtd.
protected  void parseCategory(Element loggerElement)
          Used internally to parse an category element.
protected  void parseCategoryFactory(Element factoryElement)
          Used internally to parse the category factory element.
protected  void parseChildrenOfLoggerElement(Element catElement, Logger logger, boolean isRoot)
          Used internally to parse the children of a category element.
protected  void parseErrorManager(Element element, Handler appender)
          Used internally to parse an ErrorManager element.
protected  void parseFilters(Element element, Handler appender)
          Used internally to parse a filter element.
protected  Handler parseHandler(Element appenderElement)
          Used internally to parse an appender element.
protected  Formatter parseLayout(Element layout_element)
          Used internally to parse a layout element.
protected  void parseLevel(Element element, Logger logger, boolean isRoot)
          Used internally to parse a level element.
protected  void parseRenderer(Element element)
           
protected  void parseRoot(Element rootElement)
          Used internally to parse the root category element.
protected  void setParameter(Element elem, Properties beanProps)
           
protected  String subst(String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMConfigurator

public DOMConfigurator()
No argument constructor.


DOMConfigurator

public DOMConfigurator(ErrorManager errorLog)
Method Detail

configure

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


configure

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

Throws:
FactoryConfigurationError

configure

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

Throws:
FactoryConfigurationError

configure

public static void configure(InputStream is)
                      throws FactoryConfigurationError
A static version of doConfigure(java.net.URL, LogManager).

Throws:
FactoryConfigurationError

findHandlerByName

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


findHandlerByReference

protected Handler findHandlerByReference(Element appenderRef)
Used internally to parse appenders by IDREF element.


parseHandler

protected Handler parseHandler(Element appenderElement)
Used internally to parse an appender element.


parseErrorManager

protected void parseErrorManager(Element element,
                                 Handler appender)
                          throws Exception
Used internally to parse an ErrorManager element.

Throws:
Exception

parseFilters

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

Throws:
Exception

parseCategory

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

Throws:
Exception

parseCategoryFactory

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

Throws:
Exception

parseRoot

protected void parseRoot(Element rootElement)
                  throws Exception
Used internally to parse the root category element.

Throws:
Exception

parseChildrenOfLoggerElement

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

Throws:
Exception

parseLayout

protected Formatter 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,
                            Properties beanProps)

doConfigure

public void doConfigure(String filename,
                        LogManager repository)

doConfigure

public void doConfigure(URL url,
                        LogManager repository)

doConfigure

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

Throws:
FactoryConfigurationError

doConfigure

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

Throws:
FactoryConfigurationError

doConfigure

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

Throws:
FactoryConfigurationError

doConfigure

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


parse

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


subst

protected String subst(String value)

debug

protected void debug(String msg)


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.