uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roberto Franchini" <ro.franch...@gmail.com>
Subject Re: Log4J wrapper for UIMA logger
Date Tue, 22 Jan 2008 11:17:22 GMT
On Jan 22, 2008 11:57 AM, Christoph B├╝scher
<christoph.buescher@neofonie.de> wrote:
> Hi,
>
> in die mailing list archive I read something about plans to provide a log4j
> wrapper to the UIMA logging mechanism as an alternative to the standard logger
> implementation (Jira: UIMA-282). Are there any plans to include this in a future
> release (we are currently using 2.2.1)?
>

Hi, I've made such implementation, you can find it attached to the
jira issue http://issues.apache.org/jira/browse/UIMA-282

This isn't enough, since you should configure the UIMA framework to
give you this implementation instead of standard one.
I did it in this way:
-custom Factory Config with this content:
....
<factoryConfig>
	<cpm class="org.apache.uima.collection.impl.cpm.CPMImpl"/>
    <logger class="it.celi.uima.Log4jLogger_impl"/>
...

-custom UIMAFramework class (  cut and paste the orginal one):
....
protected void parseFactoryConfig() throws
ParserConfigurationException, SAXException,
          IOException, ClassNotFoundException, InstantiationException,
IllegalAccessException {
    FactoryConfigParseHandler handler = new FactoryConfigParseHandler();
    // TOOD: Need UtilityClassLoader here? I don't think we do; this works
    // with XML4J v3. This is a good thing, since the UtilityClassLoader writes
    // to the logger, which isn't created yet!
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser parser = factory.newSAXParser();
    XMLReader reader = parser.getXMLReader();

    reader.setContentHandler(handler);
    reader.setErrorHandler(handler);
    reader
            .parse(new InputSource(UIMAFramework_impl.class
                    .getResourceAsStream("YOUR_FACTORY_XML_FILE_NAME_HERE")));
  }


and the you should give this implementation to the jvm at the startup:

java -Duima.framework_impl=my.package.UIMAFramework_impl

UIMAFrameworks lacks a parameter for che factoryConfig.xml file :(

I hope this could be usefull.
FRANK

-- 
Roberto Franchini
CELI s.r.l.  (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:ro.franchini@gmail.com skype:ro.franchini

Mime
View raw message