在Linux系统上记录速度错误

在Linux系统上记录速度错误,第1张

概述当实现Velocity时,我得到了这个错误(仅发布了“由”引起的“消息”):java.lang.RuntimeException: Velocity could not be initialized! Caused by: org.apache.velocity.exception.VelocityException: Error initializing

当实现VeLocity时,我得到了这个错误(仅发布了“由”引起的“消息”):

java.lang.RuntimeException: VeLocity Could not be initialized!Caused by: org.apache.veLocity.exception.VeLocityException: Error initializing log: Failed to initialize an instance of org.apache.veLocity.runtime.log.Log4JLogChute with the current runtime configuration.Caused by: org.apache.veLocity.exception.VeLocityException: Failed to initialize an instance of org.apache.veLocity.runtime.log.Log4JLogChute with the current runtime configuration.Caused by: java.lang.RuntimeException: Error configuring Log4JLogChute : Caused by: java.io.fileNotFoundException: veLocity.log (Permission denIEd)

这是我的代码片段:

    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系统(ubuntu 10.04)上它不起作用.这个post对我帮助不大,因为我没有找到任何线索,我必须给出写权限.

我发现,以下代码也适用于linux机器:

String logPath = request.getRealPath("/veLocity.log");RuntimeSingleton.setProperty( RuntimeConstants.RUNTIME_LOG,logPath );runtimeServices = RuntimeSingleton.getRuntimeServices();node = runtimeServices.parse(reader,templatename);

这不是一个非常好的解决方案,因为我无法确定,如果我对我的真实上下文路径有写权限.最好的是,只关闭VeLocity的记录.

我必须设置哪些不同的日志配置? NullLogChute是不工作还是我使用它不合适?

提前致谢!

最佳答案嗨问题是在写入权限受保护的fs上.
你的堆栈跟踪实际上你有:

java.io.fileNotFoundException: veLocity.log (Permission denIEd)

因此,确定速度记录的写入位置是好事.
你说一个好词,你不知道在生产中你是否可以写一个特定的路径.
因此,最好将该路径放在sysadmin可以根据需要修改的属性文件中.

如果可以帮到你,请检查我对另一篇文章的回答.

链接here 总结

以上是内存溢出为你收集整理的在Linux系统上记录速度错误全部内容,希望文章能够帮你解决在Linux系统上记录速度错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1048514.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存