Gradle 1.4-rc-1 and rc-2: logging initialization issue with custom plugin

I am using a custom gradle plugin for Velocity 1.7 that is working without a problem in Gradle 1.2 and 1.3. Starting with 1.4-rc-1 I am getting:

Caused by: java.lang.NoSuchMethodError: org.apache.log4j.PatternLayout.(Ljava/lang/String;)V

at org.apache.velocity.runtime.log.Log4JLogChute.initAppender(

at org.apache.velocity.runtime.log.Log4JLogChute.init(

at org.apache.velocity.runtime.log.LogManager.createLogChute(

at org.apache.velocity.runtime.log.LogManager.updateLog(

at org.apache.velocity.runtime.RuntimeInstance.initializeLog(

at org.apache.velocity.runtime.RuntimeInstance.init(

at org.apache.velocity.runtime.RuntimeSingleton.init(


at$ Source) … Even if I explicitly add the log4j jar to the buildscript section in my build file that initializes the custom plugin I get this error.


I think this is related to our upgrade from slf4j-1.6.6 to slf4j-1.7.2.

Since slf4j-1.7.3 is not yet released, the fix isn’t available. However, there is a workaround mentioned in the bug report:

setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new SLF4JLogChute());

Can you see if that works for you?

Yes, back porting from Velocity 2 and calling

Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new Slf4jLogChute())

does the trick, thanks.