如何将Maven项目版本放入日志文件名(log4j.xml) [英] How to put maven project version in log file name (log4j.xml)
问题描述
我想根据Maven项目版本生成日志文件.
I want to generate log file according to maven project version.
在log4j.xml文件中,添加以下行:
In the the log4j.xml file I add the following line:
<appender name="rollingFileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${catalina.home}/logs/ussdMoneyTransfert_logFile${project.version}.log" />
</appender>
但它不起作用.
推荐答案
这可以通过启用启用资源过滤后,默认情况下,Maven将使用属性值替换所有出现的 $ {...}
(如果该名称存在).属性可以来自系统属性,项目属性,过滤器资源和命令行.
When resource filtering is enabled, Maven, by default, is replacing all occurences of ${...}
with a property value (if one exist for that name). Properties can come from the system properties, your project properties, from your filter resources and from the command line.
$ {project.version}
是Maven在构建过程中添加的一个属性.在过滤过程中,它将被当前的Maven项目版本替换.
${project.version}
is one property that Maven adds during the build. It will be replaced by the current Maven project version during filtering.
这篇关于如何将Maven项目版本放入日志文件名(log4j.xml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!