Hi,
at first glance this sounds like a good solution.
As I'm quiet new to UIMA I still don't understand where the overwrite for the
configuration property (e.g. org.apache.uima.logger=<logger class>) would take
place. Would this be a system property set (e.g. on starting the JVM) or is
there another configuration property file that can be edited by the user for this?
Christoph
Michael Baessler schrieb:
Hi,
we had several requests to add a Log4j wrapper implementation to the
core framework. Roberto Franchini also provided a first implementation
that seems to work.
Now the open items are:
- add resource dependency (Log4j) to the uimaj-core POM
- add configuration functionality to configure the used logger class
instead of changing the factoryConfig.xml
How does the logger configuration currently work:
The logger implementation that is used is specified in the
factoryConfig.xml file like:
<logger class="org.apache.uima.util.impl.JSR47Logger_impl"/>
To change the logger implementation the factoryConfig.xml must be changed.
How can the configuration work in the future:
Since the factoryConfig.xml file isn't a place where the user should
change things, I would suggest to add
a configuration property specially for the logging configuration like:
org.apache.uima.logger=<logger class>
If someone would like to change the logger for the framework the
parameter must be specified. The factoryConfig.xml is not changed in
that case.
The code in the class FactoryConfigParseHandler (in
UIMAFramwork_impl.java) is modified to check if the property is
available. If it is available
the specified class is used, if it is not available the class specified
in factoryConfig.xml is used.
if ("logger".equals(qName)) {
if (context != CONTEXT_FACTORY_CONFIG) {
throw new SAXException(I18nUtil
.localizeMessage(UIMAException.STANDARD_MESSAGE_CATALOG,
Locale.getDefault(),
"element_unexpected_in_context", new Object[] {
"<logger>" }));
}
try {
// get logger class
mLoggerClass = Class.forName(attributes.getValue("class"));
// get static method getInstance()
Method instanceMethod = mLoggerClass.getMethod("getInstance",
new Class[0]);
// invoke getInstance() method and retrieve default logger object
mDefaultLogger = (Logger) instanceMethod.invoke(null, new
Class[0]);
} catch (Exception e) {
throw new SAXException(e);
}
}
Does this sounds useful and easy to use?
-- Michael
--
--------------------------------
Christoph Büscher
Softwareentwicklung
neofonie
Technologieentwicklung und
Informationsmanagement GmbH
Robert-Koch-Platz 4
10115 Berlin
fon: +49.30 24627 522
fax: +49.30 24627 120
http://www.neofonie.de
Handelsregister
Berlin-Charlottenburg: HRB 67460
Geschäftsführung
Helmut Hoffer von Ankershoffen
Nurhan Yildirim
--------------------------------