Monday, November 9, 2009

Tomcat and Wicket's unruly logging

Note: if you want the solution just skip to the end...

Like many before me, I too ran into the problem where wicket was spamming log message into "catalina.out".

At first, naively, I tried to change my file, but alas, wicket seemed intent on ignoring these changes. Following that failure, I tried changing Tomcat's but that didn't seem to effect wicket's either.

Frustrated and naturally lazy I turned over to Google, the almighty human knowledge repository. If you know what to feed in that little search box, Google can save you loads of time and also the effort of actually understanding what is it you are doing (so basically good googling skills are essential to the indolent).

In this case however, this wonderful "googelazy" phenomenon was in fact hindering my efforts. Once I realized my salvation will not be so easy, I went on to read the documents of the logging lib used by Wicket: slf4j.

After perusing the documentation for a while I ran into this:

So I've decided to check my classpath and see which implementation I'm using. It turns out I was using slf4j-simple.jar which outputs everything to System.err:

Binding for Simple implementation, which outputs all events to System.err. Only messages of level INFO and higher are printed. This binding may be useful in the context of small applications.

The solution was simple after that, replace the slf4j-simple.jar with something else, in my case it was the slf4j-log4j12.jar

Sub conclusion: if the answer was googlable it would have poped up straight away, next time I should rtfm