简体   繁体   English

更改上游项目中的速度日志文件位置

[英]Change velocity log file location in upstream project

I have a Java web application that uses a library that initializes/configures Velocity. 我有一个Java Web应用程序,它使用一个初始化/配置Velocity的库。

We're migrating this project from WebLogic to Tomcat. 我们正在将该项目从WebLogic迁移到Tomcat。

The application now throws errors, traced to Velocity. 现在,应用程序将引发错误,可追溯到Velocity。 When Velocity is initialized, the default location for the log file is in a directory which the application doesn't have permissions to write to, thus Velocity is never initialized. 初始化Velocity时,日志文件的默认位置位于应用程序无权写入的目录中,因此从未初始化Velocity。

I tried to create a velocity.properties file in the upstream project in my WEB-INF/classes directory (mirroring the folder structure of the Velocity jar file itself), but this doesn't seem to have changed anything. 我试图在我的WEB-INF/classes目录的上游项目中创建一个velocity.properties文件(镜像Velocity jar文件本身的文件夹结构),但这似乎没有任何改变。 Velocity is still failing to initialize. 速度仍然无法初始化。

Does anyone know of a way to accomplish what I'm describing? 有谁知道完成我所描述的方法的方法吗? I don't want to touch the library which is initializing Velocity–I'd rather just override the log file location in the upstream project. 我不想触摸正在初始化Velocity的库,而是只覆盖上游项目中的日志文件位置。

In your WEB-INF directory look at web.xml and look for <param-name>configURI</param-name> and it's <param-value> that follows. 在您的WEB-INF目录中,查看web.xml并查找<param-name>configURI</param-name>及其<param-name>configURI</param-name><param-value>

For example my web.xml has this 例如我的web.xml有这个

<init-param>
    <param-name>configURI</param-name>
    <param-value>WEB-INF/scripts</param-value>
</init-param>

In my WEB-INF/scripts is where my velocity.properties file is 在我的WEB-INF / scripts中是我的velocity.properties文件所在的位置

This is the property in velocity.properties that controls the log file location 这是Velocity.properties中的属性,用于控制日志文件的位置

runtime.log =

Which specifies the full path to my velocity.log 它指定了我的velocity.log的完整路径

Mine looks like this 我的看起来像这样

runtime.log =/var/log/velocity.log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM