[英]Custom log file name in mule using log4j
I'm trying to change the log file name generated by mule by modifying the log4j.xml
to have the appropriate appender. 我正在尝试通过修改
log4j.xml
以使用适当的appender来更改mule生成的日志文件名。
Here 'sa snippet from the log4j.xml
这是
log4j.xml
的一个片段
<RollingFile name="Rolling-Async-Perf" fileName="/usr/local/mule/logs/${app_name}.log"
filePattern="./logs/${date:yyyy-MM}/perf-%d{yyyy-MM-dd}-%i.log.gz" immediateFlush="false">
Here's how I set the value of application_name
in the class that loads the properties related for log4j.xml
以下是我在加载与
log4j.xml
相关的属性的类中设置application_name
的值的application_name
System.setProperty("app_name", "AppName");
However, the file generated has the name ${app_name}.log
rather than AppName.log
. 但是,生成的文件名为
${app_name}.log
而不是AppName.log
。
Any thoughts on how I could get mule to pick up the name of the file based on the custom property in mule? 有关如何根据mule中的自定义属性获取mule来获取文件名称的任何想法?
Two options are: 有两种选择:
1) add a property in the MULE_HOME/conf/wrapper.conf file for example: 1)在MULE_HOME / conf / wrapper.conf文件中添加一个属性,例如:
wrapper.java.additional.15=-Dapp_name=AppName
or 2) inside the Configuration element of your log4j2.xml file example here : 或2)在log4j2.xml文件示例的Configuration元素中:
<Properties>
<Property name="app_name">AppName</Property>
</Properties>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.