我使用了速度-1.6.2.jar
我的问题是在服务器上创建的velocity.log是在jboss / bin下启动的
jboss / bin拥有只读权限。
在我的应用程序中,当调用velocity-1.6.2.jar时,我有这个错误:
Caused by: java.io.FileNotFoundException: velocity.log (Permission denied)
我想更改Velocity.Log文件的位置
这是我的力度属性中的位置线:
# ----------------------------------------------------------------------------
# default LogChute to use: default: AvalonLogChute, Log4JLogChute, CommonsLogLogChute, ServletLogChute, JdkLogChute
# ----------------------------------------------------------------------------
runtime.log.logsystem.class = org.apache.velocity.runtime.log.AvalonLogChute,org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.CommonsLogLogChute,org.apache.velocity.runtime.log.ServletLogChute,org.apache.velocity.runtime.log.JdkLogChute
# ---------------------------------------------------------------------------
# This is the location of the Velocity Runtime log.
# ----------------------------------------------------------------------------
runtime.log = velocity.log
Runtime log可以获得完整路径,所以只需直接登录到你的desrirable文件夹/home/velocity.log
runtime.log = /home/velocity.log
错误,警告和信息性消息的日志文件的完整路径和名称。该位置(如果不是绝对的)是相对于“当前目录”的。
日志路径也可以通过编程方式设置如下:
import org.apache.velocity.app.VelocityEngine;
public class VelocityCustomEngine extends TemplateEngine {
private final VelocityEngine velocityEngine;
public VelocityCustomEngine() {
Properties properties = new Properties();
properties.setProperty("runtime.log", "/home/velocity.log");
this.velocityEngine = new VelocityEngine(properties);
}
}