You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Christoph Büscher <ch...@neofonie.de> on 2008/01/22 11:57:17 UTC

Log4J wrapper for UIMA logger

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)?

Christoph

Re: Log4J wrapper for UIMA logger

Posted by Roberto Franchini <ro...@gmail.com>.
On Jan 24, 2008 5:51 PM, Christoph Büscher
<ch...@neofonie.de> wrote:
> Hi,
>
> sounds great, in my project at work we will probably have to unify our
> UIMA/Non-UIMA logging in the next few weeks. I will then try to get in touch
> (also with Roberto, who already provided a Log4jLogger_impl) to get more more
> information about where this overwrite-mechanism for the standard logger from
> the factoryConfig.xml would be placed best in the UIMA framework.
>
> Christoph

Only one note. I choose to implement my own UIMAFramework only because
this way I can use the uima delivered jars. It's easy to patch the
UIMAFramework itself to read from a parameter (e.g.:
-Duima.factory.config=MyFactoryConfig.xml) but then you should build
the uima jars by yourself (non so difficult, MAVEN is great!).
Roberto "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

Re: Log4J wrapper for UIMA logger

Posted by Christoph Büscher <ch...@neofonie.de>.
Hi,

sounds great, in my project at work we will probably have to unify our 
UIMA/Non-UIMA logging in the next few weeks. I will then try to get in touch 
(also with Roberto, who already provided a Log4jLogger_impl) to get more more 
information about where this overwrite-mechanism for the standard logger from 
the factoryConfig.xml would be placed best in the UIMA framework.

Christoph

Michael Baessler schrieb:
> Yes, as Frank mentioned below, there is an open task to do. Till now we 
> hadn't the time to work on this.
> I like the idea to have a parameter maybe to directly set the logger 
> class which is than used in place of the one
> that is specified in the factoryConfig.xml file. So it is not necessary 
> to patch the UIMAFramework class.
> 
> If you have some free cycles you can add the missing pieces and submit 
> them as patch to UIMA-282.
> 
> Maybe together we get it into the next release.
> 
> -- Michael
> 
> Roberto Franchini wrote:
>> On Jan 22, 2008 11:57 AM, Christoph Büscher
>> <ch...@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)?


Re: Log4J wrapper for UIMA logger

Posted by Michael Baessler <mb...@michael-baessler.de>.
Yes, as Frank mentioned below, there is an open task to do. Till now we 
hadn't the time to work on this.
I like the idea to have a parameter maybe to directly set the logger 
class which is than used in place of the one
that is specified in the factoryConfig.xml file. So it is not necessary 
to patch the UIMAFramework class.

If you have some free cycles you can add the missing pieces and submit 
them as patch to UIMA-282.

Maybe together we get it into the next release.

-- Michael

Roberto Franchini wrote:
> On Jan 22, 2008 11:57 AM, Christoph Büscher
> <ch...@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
>
>   


Re: Log4J wrapper for UIMA logger

Posted by Roberto Franchini <ro...@gmail.com>.
On Jan 22, 2008 11:57 AM, Christoph Büscher
<ch...@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