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(Log4JLogChute.java:117)

at org.apache.velocity.runtime.log.Log4JLogChute.init(Log4JLogChute.java:85)

at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:157)

at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:269)

at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:871)

at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:262)

at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:112)

at org.apache.velocity.app.Velocity.init(Velocity.java:74)

at org.apache.velocity.app.Velocity$init.call(Unknown 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.

Thanks!

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

http://bugzilla.slf4j.org/show_bug.cgi?id=280 https://github.com/qos-ch/slf4j/commit/9e1edcf07bc805

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 Slf4jLogChute.java from Velocity 2 and calling

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

does the trick, thanks.