|
Log4j 0.9.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.log4j.BasicConfigurator | +--org.log4j.xml.DOMConfigurator
Use this class to initialize the log4j environment using a DOM tree.
The DTD is specified in log4j.dtd.
It is sometimes useful to see how log4j is reading configuration files. You can enable log4j internal logging by defining the log4j.configDebug variable on the java command line.
Warning The DOMConfigurator requires that the DTD file
log4j.dtd
is read by the parser. In particular, your
XML configuration files must explicitly declare a DTD with a
<!DOCTYPE> instruction. This restriction stems from ID and
IDREF attributes which cannot be used in DTDless environments.
There are sample XML files included in the package.
Fields inherited from class org.log4j.BasicConfigurator |
DISABLE_OVERRIDE_KEY, INHERITED |
Constructor Summary | |
protected |
DOMConfigurator()
No argument constructor. |
Method Summary | |
static void |
configure(org.w3c.dom.Element element)
Configure log4j using a configuration element as
defined in the log4j.dtd. |
static void |
configure(String filename)
Configure log4j by reading in a log4j.dtd compliant XML configuration file. |
static void |
configureAndWatch(String configFilename)
Like configureAndWatch(String, long) except that the
default delay as defined by FileWatchdog.DEFAULT_DELAY is
used. |
static void |
configureAndWatch(String configFilename,
long delay)
Read the configuration file configFilename if it
exists. |
protected Appender |
findAppenderByReference(org.w3c.dom.Element appenderRef)
Used internally to parse appenders by IDREF. |
protected void |
parse(org.w3c.dom.Element element)
Used internally to configure the log4j framework by parsing a DOM tree of XML elements based on log4j.dtd. |
protected Appender |
parseAppender(org.w3c.dom.Element appenderElement)
Used internally to parse an appender element. |
protected void |
parseCategory(org.w3c.dom.Element categoryElement)
Used internally to parse an category element. |
protected void |
parseChildrenOfCategoryElement(org.w3c.dom.Element catElement,
Category cat,
boolean isRoot)
Used internally to parse the children of a category element. |
protected void |
parseErrorHandler(org.w3c.dom.Element element,
Appender appender)
Used internally to parse an ErrorHandler element. |
protected void |
parseFilters(org.w3c.dom.Element element,
Appender appender)
Used internally to parse a filter element. |
protected Layout |
parseLayout(org.w3c.dom.Element layout_element)
Used internally to parse a layout element. |
protected void |
parseParameters(org.w3c.dom.Element elem,
OptionHandler oh)
Used internally to parse an param element. |
protected void |
parsePriority(org.w3c.dom.Element element,
Category cat,
boolean isRoot)
Used internally to parse a priority element. |
protected void |
parseRoot(org.w3c.dom.Element rootElement)
Used internally to parse the roor category element. |
Methods inherited from class org.log4j.BasicConfigurator |
configure, configure, disable, disableAll, disableDebug, disableInfo, enableAll, flagAsShippedCode, overrideAsNeeded, resetConfiguration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected DOMConfigurator()
Method Detail |
protected Appender findAppenderByReference(org.w3c.dom.Element appenderRef)
protected Appender parseAppender(org.w3c.dom.Element appenderElement)
protected void parseErrorHandler(org.w3c.dom.Element element, Appender appender)
ErrorHandler
element.protected void parseParameters(org.w3c.dom.Element elem, OptionHandler oh)
param
element.protected void parseFilters(org.w3c.dom.Element element, Appender appender)
protected void parseCategory(org.w3c.dom.Element categoryElement)
protected void parseRoot(org.w3c.dom.Element rootElement)
protected void parseChildrenOfCategoryElement(org.w3c.dom.Element catElement, Category cat, boolean isRoot)
protected Layout parseLayout(org.w3c.dom.Element layout_element)
protected void parsePriority(org.w3c.dom.Element element, Category cat, boolean isRoot)
public static void configure(org.w3c.dom.Element element)
configuration
element as
defined in the log4j.dtd.
Note: This public method relies on DOM Level-2 API.
public static void configureAndWatch(String configFilename)
configureAndWatch(String, long)
except that the
default delay as defined by FileWatchdog.DEFAULT_DELAY
is
used.
Note: This public method relies on DOM Level-2 API, and a JAXP compliant parser. At the time of this writing only the Apache Xerces parser fulfills both requirements.
configFilename
- A log4j configuration file in XML format.public static void configureAndWatch(String configFilename, long delay)
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.
Note: This public method relies on DOM Level-2 API, and a JAXP compliant parser. At the time of this writing only the Apache Xerces parser fulfills both requirements.
configFilename
- A log4j configuration file in XML format.delay
- The delay in milliseconds to wait between each check.public static void configure(String filename) throws javax.xml.parsers.FactoryConfigurationError
Note: This public method relies on DOM Level-2 API, and a JAXP compliant parser. At the time of this writing only the Apache Xerces parser fulfills both requirements.
protected void parse(org.w3c.dom.Element element)
|
Log4j 0.9.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |