Hello to all,
The javadoc documentation for PropertyConfigurator.doConfigure(String
Hierarchy) states that when the configuration is read from a file, the
existing configuration is not cleared nor reset. I have written a test
program that seems to exhibit behavior at variance to that description, and
I am seeking clarification.
I am working on a project that will have fixed hardcoded values for the
common appenders used on all Java apps at the company, and individual
applications can add additional appenders or change the thresholds of the
standard appenders or the root category priority level via a properties
file. Thus, the properties file must be read after the hardcoded appenders
are added.
My test program adds (hardcoded) a console appender to the root category.
Then PropertyConfigurator.configure(props) is called on a Properties class
loaded from a text file application.properties; this file defines a file
appender to be added to the root category.
Before and after the call to PropertyConfigurator.configure, the
enumeration of existing appenders is printed. Before the call,
consoleAppend is the only appender. After the call, fileAppend is the only
appender.
Try running java propertyConfigurator_t with the file application.properties
in the same directory (the console appender will be deleted, the file
appender will be present) and with the file application.properties removed
(the console appender will be present).
A comment in the code of PropertyConfigurator.java line 561 just before the
line cat.removeAllAppenders( ) states
// Remove all existing appenders. They will be reconstructed below.
I step through the code and do not see any reconstruction. What does that
comment mean?
<<propertyConfigurator_t.java>> <<application.properties>>
Thanks in advance,
Alan Grenadir
BlackRock
propertyConfigurator_t.java
application.properties
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]