Linux系统上velocity中的日志错误
在安装Velocity时,我收到此错误(仅张贴“原因”-消息): 这是我的代码片段:Linux系统上velocity中的日志错误,linux,logging,velocity,Linux,Logging,Velocity,在安装Velocity时,我收到此错误(仅张贴“原因”-消息): 这是我的代码片段: VelocityEngine ve = new VelocityEngine(); ve.evaluate(context, writer, "org.apache.velocity.runtime.log.NullLogChute", this.templateString); 起初,我的代码如下所示: runtimeServices = RuntimeSingleton.getRuntim
VelocityEngine ve = new VelocityEngine();
ve.evaluate(context, writer, "org.apache.velocity.runtime.log.NullLogChute", this.templateString);
起初,我的代码如下所示:
runtimeServices = RuntimeSingleton.getRuntimeServices();
node = runtimeServices.parse(reader, templateName);
在我的Windows机器上,它工作正常,但在Linux系统(Ubuntu10.04)上,它不工作。这对我帮助不大,因为我还没有找到任何线索,我必须给哪个目录授予写权限
我发现以下代码在Linux机器上也能工作:
String logPath = request.getRealPath("/velocity.log");
RuntimeSingleton.setProperty( RuntimeConstants.RUNTIME_LOG, logPath );
runtimeServices = RuntimeSingleton.getRuntimeServices();
node = runtimeServices.parse(reader, templateName);
这不是一个很好的解决方案,因为我永远无法确定我是否拥有对真实上下文路径的写入权限。最好的办法是关闭速度记录
我必须设置哪些不同的日志记录配置?nulllogsleet
只是不起作用还是我使用它不合适
提前谢谢 嗨,问题出在写入权限中受保护的fs上。 事实上,在stacktrace中,您有:
java.io.FileNotFoundException: velocity.log (Permission denied)
所以它是决定速度记录在哪里的好东西。
如果你说了一句好话,你就不知道在制作过程中你是否可以写一条特定的路径。
因此,最好将该路径放在sysadmin可以根据需要修改的属性文件中
所以,如果我能帮你的话,请在另一个帖子上查看我的答案
链接
java.io.FileNotFoundException: velocity.log (Permission denied)