如何禁用速度日志

lui*_*979 14 java logging tomcat velocity

我一直试图禁用Velocity日志,到目前为止我发现的唯一方法是获得积极的结果是设置:

runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogSystem
Run Code Online (Sandbox Code Playgroud)

但是在velocity.jar里面的velocity.properties里面.

我在Web应用程序(tomcat)上下文中使用了velocity.有没有办法禁用速度(通过设置以前的属性或其他)但不修改JAR?

无法修改任何CODE

提前致谢

ded*_*dek 14

一般情况下:只需添加以下行velocity.properties:

runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogChute
Run Code Online (Sandbox Code Playgroud)

问题:这取决于速度引擎的加载方式.可以给它一个自定义velocity.properties文件吗?
例如,Solr VelocityResponseWriter有这样的属性v.properties(或init.properties.file在当前版本中).
看,如果org.apache.velocity.app.VelocityEngine.init(Properties)在代码的某个地方调用该方法...


har*_*rsh 5

这是配置所需登录方式的方法velocity

//java configuration
VelocityEngine ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.Log4JLogChute" );
ve.setProperty("runtime.log.logsystem.log4j.logger","velocity");

//log4j properties
log4j.category.velocity=WARN
Run Code Online (Sandbox Code Playgroud)

IMHO INFO很好用velocity,在启动时,您会注意到一些有用的速度引擎配置详细信息,但是在模板制作过程中,没有什么特别的问题INFO