Deactivating Elk messages

48 views
Skip to first unread message

Mikel Egaña Aranguren

unread,
Sep 13, 2012, 1:10:23 PM9/13/12
to elk-reasone...@googlegroups.com
Hi;

I'm using Elk through the OWL API as part of a workflow system (http://galaxy.psu.edu/).

Elk sends to stdout all sorts of messages (unsupported axioms etc.) and I need to stop it, ie, I need Elk to be completely silent and only throw errors to stderr.

Is there a simple way of achieving this?

Many thanks

Yevgeny Kazakov

unread,
Sep 13, 2012, 1:53:13 PM9/13/12
to elk-reasone...@googlegroups.com
Dear Mikel,

On Thu, Sep 13, 2012 at 7:10 PM, Mikel Egaña Aranguren
<mikel.egan...@gmail.com> wrote:
> Hi;
>
> I'm using Elk through the OWL API as part of a workflow system
> (http://galaxy.psu.edu/).

Thanks letting us know that you use ELK!
We are happy to mention your project on our wiki page (the list of
projects the use ELK), if you don't object.

> Elk sends to stdout all sorts of messages (unsupported axioms etc.) and I
> need to stop it, ie, I need Elk to be completely silent and only throw
> errors to stderr.
>
> Is there a simple way of achieving this?

ELK prints all messages using the log4j library (the one that is
included in the lib folder of the ELK OWL API distribution). By
default, a log4j appender is configured to print all messages of the
level WARN or higher (ERROR and FATAL) to stdout (see the file
log4j.properties contained in elk-owlapi.jar), but you can easily
override these settings. For example, you can remove all appenders
associated with ELK in Java as follows:

(Logger.getLogger("org.semanticweb.elk").removeAllAppenders());

And then you can register your appenders, e.g., that print all warning
messages to a text file.
I would strongly recommend to have at least one appender registered,
or to provide an option to do so, so that the users of your
application are able to see those warnings, if necessary.

Best regards,

Yevgeny

Mikel Egaña Aranguren

unread,
Sep 14, 2012, 4:37:55 AM9/14/12
to elk-reasone...@googlegroups.com
OK thanks for the explanation, I will try this.

The project I'm working on is OPPL-Galaxy
(http://miuras.inf.um.es/OPPL-Galaxy/index.html), a wrapper of the
Ontology Pre Processor Language (http://oppl2.sourceforge.net/) for
the Galaxy Bioinformatics platform (http://galaxy.psu.edu/). The tool
has been downloaded ~350 times from the Galaxy tool shed
(http://toolshed.g2.bx.psu.edu/) so there is at least a bit of
interest ;-)

Cheers

2012/9/13 Yevgeny Kazakov <yevgeny...@uni-ulm.de>:
--
Mikel Egaña Aranguren, Ph.D.

http://mikeleganaaranguren.com

Yevgeny Kazakov

unread,
Sep 17, 2012, 6:26:32 AM9/17/12
to elk-reasone...@googlegroups.com
I have now added some instructions on wiki how to disable or
reconfigure log messages in ELK from java (see at the bottom):

http://code.google.com/p/elk-reasoner/wiki/ElkOwlApi

Yevgeny

Mikel Egaña Aranguren

unread,
Sep 17, 2012, 7:41:20 AM9/17/12
to elk-reasone...@googlegroups.com
Yes, this option works for me, thanks

2012/9/17 Yevgeny Kazakov <yevgeny...@uni-ulm.de>:

RL Wang

unread,
Jul 22, 2016, 1:17:02 PM7/22/16
to elk-reasoner-discussion
Hi,

I am also trying to suppress the large amount of screen output from ELK by various methods based on either log4j.2.xx or log4j.1.xxx.  None of them below worked.

Logger.getLogger("org.semanticweb.elk").setLevel(Level.OFF);
Configurator.setRootLevel(org.apache.logging.log4j.Level.OFF);
Configurator.setLevel("org.semanticweb.elk", org.apache.logging.log4j.Level.OFF);
 LogManager.getLogger("org.semanticweb.elk").log(org.apache.logging.log4j.Level.OFF,"no logging");
LogManager.getRootLogger().log(org.apache.logging.log4j.Level.OFF, "null");

I continue to get stdout like

Incremental Addition started
Incremental Addition using 8 workers
Incremental Addition took 0 ms
Incremental Taxonomy Cleaning started
Incremental Taxonomy Cleaning using 8 workers
Incremental Taxonomy Cleaning took 0 ms
Incremental Consistency Checking started
...

I understand that elk-owlapi-0.4.3.jar uses log4j-1.2.14, which is outdated.  So I installed log4j 2.6.2.  Still, none of the methods above worked.  Any suggestions?  Would this copious amount of stdout produced continuously actually slow down my job?

Thanks much!

Ronglin

Yevgeny Kazakov

unread,
Jul 22, 2016, 1:34:57 PM7/22/16
to elk-reasone...@googlegroups.com
Dear Ronglin,

Does it work for you with this example [1]?

--
You received this message because you are subscribed to the Google Groups "elk-reasoner-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RL Wang

unread,
Jul 22, 2016, 3:08:24 PM7/22/16
to elk-reasoner-discussion, yevgeny...@uni-ulm.de
Hi Yevgeny,

Not sure which example you were referring to.  The top part of the webpage with regard to generating and saving an inferred ontology?  That works, albeit very slowly for my testing of vertebrate.owl (http://www.berkeleybop.org/ontologies/upheno/).  As to the sample code on the bottom of the page, Logger.getLogger("org.semanticweb.elk").setLevel(Level.OFF) didnt work.  And Logger.getRootLogger() method doesn't exist somehow. In log4j.2.6.2, the syntax is LogManager.getRootLogger.  That doesnt work either.  To be clear, the kind of ELK output I want to turn off is like
Incremental Addition started
Incremental Addition using 8 workers
Incremental Addition took 0 ms
Incremental Taxonomy Cleaning started
Incremental Taxonomy Cleaning using 8 workers
Incremental Taxonomy Cleaning took 0 ms
Incremental Consistency Checking started

Thanks much!

Ronglin
To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-discussion+unsub...@googlegroups.com.

Yevgeny Kazakov

unread,
Jul 22, 2016, 5:08:43 PM7/22/16
to elk-reasone...@googlegroups.com
Do you use log4j.properties?

Can you try adding:

log4j.category.org.semanticweb.elk=OFF



To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-disc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elk-reasoner-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-disc...@googlegroups.com.

Yevgeny Kazakov

unread,
Jul 22, 2016, 5:14:25 PM7/22/16
to elk-reasone...@googlegroups.com
... or programmatically before you use ELK:

LogManager.getLogger("org.semanticweb.elk").setLevel(Level.OFF);

Yevgeny Kazakov

unread,
Jul 22, 2016, 5:30:57 PM7/22/16
to elk-reasone...@googlegroups.com
I just tested, both of these methods work for me with:

log4j-1.2.14.jar
slf4j-api-1.7.13.jar
owlapi-distribution-4.2.3.jar
SavingInferredAxioms.java (from the examples folder of the above zip and pizza.owl)

I did not check yet if it works with log4j-2.x

- Yevgeny

RL Wang

unread,
Jul 24, 2016, 2:40:12 PM7/24/16
to elk-reasoner-discussion, yevgeny...@uni-ulm.de
Hi Yevgeny,

Finally got it working.  I think what happened is that the import statements of different packages (java utilities, log4j 2.x, log4j.1.x) got mixed up.  What ended up works using log4j.1.2.14 is

****
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;

LogManager.getLogger("org.semanticweb.elk").setLevel(Level.OFF)
****

A side question:  is ELK going to support down the road owlapi reasoner.getDisjointClasses() method?

Thanks much!

Ronglin
- Yevgeny


To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-discussion+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elk-reasoner-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-discussion+unsub...@googlegroups.com.

Yevgeny Kazakov

unread,
Aug 4, 2016, 4:50:30 AM8/4/16
to RL Wang, elk-reasoner-discussion
Dear Ronglin,

On Sun, Jul 24, 2016 at 8:40 PM, RL Wang <rlw...@gmail.com> wrote:
Hi Yevgeny,

Finally got it working.  I think what happened is that the import statements of different packages (java utilities, log4j 2.x, log4j.1.x) got mixed up.  What ended up works using log4j.1.2.14 is

****
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;

LogManager.getLogger("org.semanticweb.elk").setLevel(Level.OFF)
****

I am glad it worked for you. Did you try the method with log4j.properties. I think this should be preferred as it does not depend on the version of log4j.
Also, you do not have to use log4j in ELK. ELK uses slf4j for logging, so you can use any logging framework compatible with slf4j, e.g., logback.
 

A side question:  is ELK going to support down the road owlapi reasoner.getDisjointClasses() method?

We can easily support retrieving disjoint classes by simply iterating over all classes and checking for disjointness. It is very inefficient, but I think this is how all other reasoners are supporting this task. For this reason, e.g., it is switched off in Protege by default. Similarly we can support many other reasoning task, such as retrieving domain and ranges of properties, simply by iterating over all classes and checking the corresponding condition. Would it be really useful to have them implemented like that? I think anyone can write such an implementation directly in OWL API with a few lines of code.

Best regards,

Yevgeny


 
- Yevgeny


To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-disc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elk-reasoner-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elk-reasoner-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages