Monday, April 10, 2006

Java - how to turn off Apache Commons Logging Part II

Last week I discovered how to turn off logging via a directive. Today, I needed to turn off logging in an applet that had been built using those same libraries. It was quick and easy. I create a file called commons-logging.properties, with a single line that looks like this:

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

I then placed that file in the root of my jar file, like this:

jar cvf MyApplet.jar commons-logging.properties com/wereldmuis/MyApplet.class

(Obviously, the properties file has to be sitting in the directory where you run the jar command.)

When I deployed the jar file, comments had been turned off; worked immediately. How pleasant!

There's documentation at Jakarata, but it's not great IMHO. They don't give enough examples.

0 Comments:

Post a Comment

<< Home