This might be completely obvious to everyone - but I just thought I'd explain what I've just started doing with my IDE and I wished I'd done this a long long time ago...

So ActiveMQ uses log4j.properties on the classpath (usually in $module/src/test/resources/). By default the logging level is INFO and it goes to a log file so that when you run the maven build it doesn't fill the screen with lots of garbage. (Incidentally some tests are timing sensitive, so setting logging level to DEBUG will often cause some tests to fail as debug logging slows things down so much)

However when running stuff in your IDE - e.g. working on a specific test case or program, you often want output to the console so you see it nicely in your IDE. Often you want debug too.

So for the longest time I've been hacking, say, the activemq-core/src/ test/resources/log4j.properties file for IDE use to enable stdout / DEBUG; then having to remember to switch it back when doing subversion commits etc.

I'm sure somewhere there's a great log4j plugin to eclipse that actually works well (I've tried a few plugins for IDEs over the years and never managed to get them to work well); but as a quick hack I created a new project called IDE which just contains stuff to put on the classpath when running stuff in your IDE; so added a log4j.properties for IDE use. Then I added this as the first dependency in the ActiveMQ project and voila - no more hack-revert of the log4j.properties in the maven build; I can keep the 2 separate.

Totally trivial and obvious - and I'm sure some ecilpse plugin somewhere solves this better - but its well worth doing something like this if you hack on the ActiveMQ code a fair bit.

James
-------
http://radio.weblogs.com/0112098/

Reply via email to