How to disable velocity logs

luiso1979 picture luiso1979 · Oct 18, 2013 · Viewed 18.2k times · Source

I've been trying to disable Velocity logs, and the only way I've found so far with positive results is to set:

runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogSystem

but inside the velocity.properties that resides inside the velocity.jar.

I'm using velocity in a Web Application (tomcat) context. Is there any way to disable the velocity (by setting the previous property or whatever) BUT without modifying the JAR??

Cannot modify any CODE

Thanks in advance

Answer

dedek picture dedek · Mar 12, 2014

In general: just add following line to your velocity.properties :

runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogChute

To your question: It depends on how the velocity engine is loaded. Is it possible to give it a custom velocity.properties file?
For example Solr's VelocityResponseWriter has such property called v.properties (or init.properties.file in current versions).
Look, if the method org.apache.velocity.app.VelocityEngine.init(Properties) is called somewhere in the code...