jboss - 更改 Velocity.Log 文件的位置

我使用了velocity-1.6.2.jar

我的问题是 速度.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可以获得完整路径,因此只需将/home/velocity.log 直接登录到所需的文件夹

 runtime.log = /home/velocity.log

Full path and name of log file for error, warning, and informational messages. The location, if not absolute, is relative to the 'current directory'.



更新 (27-02-2018)

日志路径也可以通过编程方式设置如下:
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);
    }
}

https://stackoverflow.com/questions/46621916/

相关文章:

scala - 在 Spark 中将连续变量转换为分类变量

date - 计算上次登录和当前日期之间的天数

macos - 安装 Unity 和 Android SDK for Mac 时,adb 在哪里?

loops - JMeter while 循环(使用自己的索引停止循环)

nlp - gensim doc2vec "intersect_word2vec_format"命令

php - cakephp 3 编辑用户用户名和密码 - 无法找到当前实体的表类

macos - 在OS X上构建OpenSSH:配置:警告:sandbox.h:存在,但无法编译

javascript - JSON 到 XML 使用 Javascript

macos - tmux没有在/private/tmp/tmux-502/default上运行的服务

android - 带数据绑定(bind)的 ConstraintLayout