1
如何从“/opt/applications/app1/log/config/log4j2.xml”这样的特定文件中获取骡子应用程序中的配置3.6.2。常用的方法是从配置文件log4j2.xml中获取存储在资源文件夹中的配置信息,我们需要从其他外部路径读取此配置文件。log4j2.xml骡子应用程序中的配置文件3.6.2
如何从“/opt/applications/app1/log/config/log4j2.xml”这样的特定文件中获取骡子应用程序中的配置3.6.2。常用的方法是从配置文件log4j2.xml中获取存储在资源文件夹中的配置信息,我们需要从其他外部路径读取此配置文件。log4j2.xml骡子应用程序中的配置文件3.6.2
默认情况下,Mule使用自己的log4j2文件进行日志记录。要从外部路径读取log4j2.xml配置文件,请在您的文件应用程序上下文中添加下一个Bean,为此指定要在Mule的上下文General中使用的外部文件。
应用程序上下文:
<bean id="loggerContext" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass">
<value> org.apache.logging.log4j.LogManager</value>
</property>
<property name="targetMethod">
<value>getContext</value>
</property>
<property name="arguments">
<value>false</value>
</property>
</bean>
<bean id="loggerContext1" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="loggerContext" />
<property name="targetMethod">
<value>setConfigLocation</value>
</property>
<property name="arguments">
<value>${log4j.external.path}</value>
</property>
</bean>
<bean id="loggerContext2" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="loggerContext" />
<property name="targetMethod">
<value>reconfigure</value>
</property>
</bean>
然后,你需要从文件骡流程导入此背景下,具有:
骡配置
<mule xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core"
{..}
<!-- Add this: -->
<spring:beans>
<spring:import resource="classpath*:application-context.xml" />
</spring:beans>
{..}
<flow name="http-name" >
{..}
</flow>
</mule>
然后是有必要导入应用程序上下文?,或者我可以在mule配置文件中进行配置? –
是的,它在mule配置文件中的可能配置,但我建议你分开mule。 – JhonQO