Enable logging in Jabref

Recently, I started to fix some issues in the Bibsonomy JabRef plugin. As debugging is not possible if you don't get any information about what's going on, I tried to enable logging. According to the Bibsonomy website the plugin uses Log4J for logging. But I was unable to change the console output of JabRef. I simply didn't accept my log4j.properties. After some time I found the reason: It's using Apache commons logging. So maybe the Bibsonomy team uses Log4J for logging, but my installation doesn't.

As Log4J isn't provided neither by JabRef nor by the Bibsonomy plugin, this library must be loaded explicitely. I was too lazy to do that. So I decided to use SimpleLog, as it is provided by Apache commons logging. It can be configured if you put a file named “simplelog.properties” along with your JabRef.jar binary. The logger can be enabled by writing a file named “commons-logging.properties” at the same location that contains the following line:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

I decided to pass it by command line to Java using the -D switch. The command line looks like:

java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -jar path/to/JabRef-2.9.2.jar

I's sufficient for my purpose and I can enable logging, if needed. Otherwise the default of my JVM is used.

Finally an example of simplelog.properties:

org.apache.commons.logging.simplelog.defaultlog = info
org.apache.commons.logging.simplelog.log.org.bibsonomy.plugin.jabref = trace
org.apache.commons.logging.simplelog.log.org.bibsonomy.rest.client.worker = trace
org.apache.commons.logging.simplelog.log.org.bibsonomy.rest.client.worker.PutWorker=trace
org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient = trace