I learned a few new tricks recently that I thought are pretty cool.
If you use apache log4j, you can get very frustrated sometimes that it does not log based on what you defined in your log4j.properties file. This is because if your java web application contains other jars that also have log4j.properties, the log4j will use the first log4j.properties on the classpath which most of the times is NOT what you defined for your web app. I never knew a solution to this until recently my coworker was able to use spring to get around it. In your spring context, add
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetClass" value="org.springframework.util.Log4jConfigurer"/> <property name="targetMethod" value="initLogging" /> <property name="arguments"> <list> <value>log4j.properties</value> </list> </property> </bean>
This will make sure the one you defined for your web app is used.
Also I recently wrote a groovy script in ant. I learned that you can use ivy to cache as instance of a jar and then you can use it in your ant script.
<target name="groovyScript"> <ivy:configure url="http://ivy.somedomain.com/ivyRepository/ivysettings.xml" /> <ivy:resolve conf="ant"/> <ivy:cachepath pathid="cp" conf="ant"/> <taskdef name="groovy" classpathref="cp" classname="org.codehaus.groovy.ant.Groovy"/> <groovy> <!-- your groovy script here --> </groovy>
On the other note, I heard if you were going to hack to use groov