Save This Page
Home » slf4j-1.5.5 » org.apache » log4j » xml » [javadoc | source]
org.apache.log4j.xml
public class: DOMConfigurator [javadoc | source]
java.lang.Object
   org.apache.log4j.xml.DOMConfigurator

All Implemented Interfaces:
    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.

Field Summary
static final  String CONFIGURATION_TAG     
static final  String OLD_CONFIGURATION_TAG     
static final  String RENDERER_TAG     
static final  String APPENDER_TAG     
static final  String APPENDER_REF_TAG     
static final  String PARAM_TAG     
static final  String LAYOUT_TAG     
static final  String CATEGORY     
static final  String LOGGER     
static final  String LOGGER_REF     
static final  String CATEGORY_FACTORY_TAG     
static final  String LOGGER_FACTORY_TAG     
static final  String NAME_ATTR     
static final  String CLASS_ATTR     
static final  String VALUE_ATTR     
static final  String ROOT_TAG     
static final  String ROOT_REF     
static final  String LEVEL_TAG     
static final  String PRIORITY_TAG     
static final  String FILTER_TAG     
static final  String ERROR_HANDLER_TAG     
static final  String REF_ATTR     
static final  String ADDITIVITY_ATTR     
static final  String THRESHOLD_ATTR     
static final  String CONFIG_DEBUG_ATTR     
static final  String INTERNAL_DEBUG_ATTR     
static final  String RENDERING_CLASS_ATTR     
static final  String RENDERED_CLASS_ATTR     
static final  String EMPTY_STR     
static final  Class[] ONE_STRING_PARAM     
static final  String dbfKey     
 Hashtable appenderBag     
 Properties props     
 LoggerRepository repository     
protected  LoggerFactory catFactory     
Constructor:
 public DOMConfigurator() 
Method from org.apache.log4j.xml.DOMConfigurator Summary:
configure,   configure,   configure,   configureAndWatch,   configureAndWatch,   doConfigure,   doConfigure,   doConfigure,   doConfigure,   doConfigure,   doConfigure,   findAppenderByName,   findAppenderByReference,   parse,   parseAppender,   parseCategory,   parseCategoryFactory,   parseChildrenOfLoggerElement,   parseElement,   parseErrorHandler,   parseFilters,   parseLayout,   parseLevel,   parseRenderer,   parseRoot,   setParameter,   setParameter,   subst,   subst
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.xml.DOMConfigurator Detail:
 public static  void configure(Element element) 
    Configure log4j using a configuration element as defined in the log4j.dtd.
 public static  void configure(String filename) throws FactoryConfigurationError 
 public static  void configure(URL url) throws FactoryConfigurationError 
 public static  void configureAndWatch(String configFilename) 
 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.
 public  void doConfigure(String filename,
    LoggerRepository repository) 
 public  void doConfigure(URL url,
    LoggerRepository repository) 
 public  void doConfigure(InputStream inputStream,
    LoggerRepository repository) throws FactoryConfigurationError 
    Configure log4j by reading in a log4j.dtd compliant XML configuration file.
 public  void doConfigure(Reader reader,
    LoggerRepository repository) throws FactoryConfigurationError 
    Configure log4j by reading in a log4j.dtd compliant XML configuration file.
 protected  void doConfigure(InputSource inputSource,
    LoggerRepository repository) throws FactoryConfigurationError 
    Configure log4j by reading in a log4j.dtd compliant XML configuration file.
 public  void doConfigure(Element element,
    LoggerRepository repository) 
    Configure by taking in an DOM element.
 protected Appender findAppenderByName(Document doc,
    String appenderName) 
    Used internally to parse appenders by IDREF name.
 protected Appender findAppenderByReference(Element appenderRef) 
    Used internally to parse appenders by IDREF element.
 protected  void parse(Element element) 
    Used internally to configure the log4j framework by parsing a DOM tree of XML elements based on log4j.dtd.
 protected Appender parseAppender(Element appenderElement) 
    Used internally to parse an appender element.
 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 cat,
    boolean isRoot) 
    Used internally to parse the children of a category element.
 public static Object parseElement(Element element,
    Properties props,
    Class expectedClass) throws Exception 
    Creates an object and processes any nested param elements but does not call activateOptions. If the class also supports UnrecognizedElementParser, the parseUnrecognizedElement method will be call for any child elements other than param.
 protected  void parseErrorHandler(Element element,
    Appender appender) 
 protected  void parseFilters(Element element,
    Appender appender) 
    Used internally to parse a filter element.
 protected Layout 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 roor category element.
 protected  void setParameter(Element elem,
    PropertySetter propSetter) 
 public static  void setParameter(Element elem,
    PropertySetter propSetter,
    Properties props) 
    Sets a parameter based from configuration file content.
 protected String subst(String value) 
 public static String subst(String value,
    Properties props) 
    Substitutes property value for any references in expression.