|
NLOG4J 1.2.24 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.log4j.xml.DOMConfigurator
public class DOMConfigurator
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 |
---|
Fields inherited from interface org.apache.log4j.spi.Configurator |
---|
INHERITED, NULL |
Constructor Summary | |
---|---|
DOMConfigurator()
No argument constructor. |
Method Summary | |
---|---|
static void |
configure(Element element)
Configure log4j using a configuration element as
defined in the log4j.dtd. |
static void |
configure(String filename)
A static version of doConfigure(String, LoggerRepository) . |
static void |
configure(URL url)
A static version of doConfigure(URL, LoggerRepository) . |
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. |
void |
doConfigure(Element element,
LoggerRepository repository)
Configure by taking in an DOM element. |
protected void |
doConfigure(InputSource inputSource,
LoggerRepository repository)
Configure log4j by reading in a log4j.dtd compliant XML configuration file. |
void |
doConfigure(InputStream inputStream,
LoggerRepository repository)
Configure log4j by reading in a log4j.dtd compliant XML configuration file. |
void |
doConfigure(Reader reader,
LoggerRepository repository)
Configure log4j by reading in a log4j.dtd compliant XML configuration file. |
void |
doConfigure(String filename,
LoggerRepository repository)
|
void |
doConfigure(URL url,
LoggerRepository repository)
Interpret a resource pointed by a URL and set up log4j accordingly. |
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. |
protected void |
parseErrorHandler(Element element,
Appender appender)
Used internally to parse an ErrorHandler element. |
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)
|
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 |
---|
public DOMConfigurator()
Method Detail |
---|
protected Appender findAppenderByName(Document doc, String appenderName)
protected Appender findAppenderByReference(Element appenderRef)
protected Appender parseAppender(Element appenderElement)
protected void parseErrorHandler(Element element, Appender appender)
ErrorHandler
element.
protected void parseFilters(Element element, Appender appender)
protected void parseCategory(Element loggerElement)
protected void parseCategoryFactory(Element factoryElement)
protected void parseRoot(Element rootElement)
protected void parseChildrenOfLoggerElement(Element catElement, Logger cat, boolean isRoot)
protected Layout parseLayout(Element layout_element)
protected void parseRenderer(Element element)
protected void parseLevel(Element element, Logger logger, boolean isRoot)
protected void setParameter(Element elem, PropertySetter propSetter)
public static void configure(Element element)
configuration
element as
defined in the log4j.dtd.
public static void configureAndWatch(String configFilename)
configureAndWatch(String, long)
except that the
default delay as defined by FileWatchdog.DEFAULT_DELAY
is
used.
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.
configFilename
- A log4j configuration file in XML format.delay
- The delay in milliseconds to wait between each check.public void doConfigure(String filename, LoggerRepository repository)
public void doConfigure(URL url, LoggerRepository repository)
Configurator
hierarchy
parameter.
doConfigure
in interface Configurator
url
- The URL to parserepository
- The hierarchy to operation upon.public void doConfigure(InputStream inputStream, LoggerRepository repository) throws FactoryConfigurationError
FactoryConfigurationError
public void doConfigure(Reader reader, LoggerRepository repository) throws FactoryConfigurationError
FactoryConfigurationError
protected void doConfigure(InputSource inputSource, LoggerRepository repository) throws FactoryConfigurationError
FactoryConfigurationError
public void doConfigure(Element element, LoggerRepository repository)
public static void configure(String filename) throws FactoryConfigurationError
doConfigure(String, LoggerRepository)
.
FactoryConfigurationError
public static void configure(URL url) throws FactoryConfigurationError
doConfigure(URL, LoggerRepository)
.
FactoryConfigurationError
protected void parse(Element element)
protected String subst(String value)
|
NLOG4J 1.2.24 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |