phenoscape / owlery

Owlery is a set of REST web services which allow querying of an OWL reasoner containing a configured set of ontologies.
MIT License
16 stars 11 forks source link

Log4J configuration missing? #131

Closed rpgoldman closed 3 years ago

rpgoldman commented 3 years ago

Trying to start Owlery from the Docker container I get the following warning, because of a missing or incorrect log4j configuration. I did read the FAQ the error cites but ... it is not at all helpful. In particular, it says

Knowing the appropriate location to place log4j.properties or log4j.xml requires understanding the search strategy of the class loader in use.

A little googling suggests that I might need to put something in the akka configuration, but I am not sure what. But I'm not sure that is right, since the error message just mentions jena.

docker run --rm -p 8080:8080 -v /Users/rpg/projects/xplan/container-ontology/owl/:/srv/owl -v /Users/rpg/projects/xplan/container-ontology/owl/owlery-conf:/srv/config phenoscape/owlery:latest
log4j:WARN No appenders could be found for logger (org.apache.jena.util.FileManager).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
rpgoldman commented 3 years ago

@balhoff Assuming you use OWLAPI in Owlery, is there some way I can configure Log4j so that I can see messages from OWLAPI?

rpgoldman commented 3 years ago

Hoping this will help: https://github.com/owlcs/owlapi/issues/1015

balhoff commented 3 years ago

Thanks! We may need to include a log4j implementation. I will come back to this after a couple of the other issues. I have some unrelated tasks slowing me down here.

rpgoldman commented 3 years ago

@balhoff I just looked at /usr/share/owlery/bin/owlery, and it looks like there is a log4j implementation included in Owlery's classpath: $lib_dir/log4j.log4j-1.2.17.jar.

And I checked and the jar file is there in the Docker image.

Trying to follow the suggestion here, I ran the docker image as follows, but adding the default log level flag has had no visible effect:

docker run --rm --env JAVA_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG -p 8080:8080 -v /Users/rpg/projects/xplan/container-ontology/owl//server-files:/srv/owl -v /Users/rpg/projects/xplan/container-ontology/owl/owlery-conf:/srv/conf owlery:latest

When I run a bash shell inside the container I see that JAVA_OPTS is bound, so I assume that Java is seeing it, it's just not having an effect, possibly because of the log4j configuration issue. Will experiment more.

rpgoldman commented 3 years ago

I should correct the above: it does seem to work to the extent that this removes the log4j warning method. But ... I am still not seeing any log entries out of OWLAPI. So perhaps I need to be doing something to redirect the logging for OWLAPI to a different location. Maybe setting a handler? AFAICT from reading the docs, sl4fj should be defaulting to a handler that will write to standard output, but I still only see output from the akka logger; nothing from OWLAPI. Possibly the server doesn't have standard output in the way I expect it would?

I wish the Java logging infrastructure wasn't so complicated...

rpgoldman commented 3 years ago

I'm closing this because I read the logs, found a couple of IRI issues, fixed them, and everything is working brilliantly! Thanks to both of you, @balhoff and @hlapp

balhoff commented 3 years ago

That's great, thanks for your perseverance. A lot of things are in better shape as a result.

rpgoldman commented 3 years ago

The thanks are all due to you, for fixing things so quickly!