We have a specific requirement to load log4j2.xml file from external location rather than classpath. I've tried below approaches:
mule_artifact.json: Specifying "logConfigFile" in this json works but the problem is that it has to be absolute path. Unfortunately, we have different paths in different servers. Don't thin it supports property placeholders or system properties inside this property.
beans.xml: Initialising beans.xml with log4j file as below and importing using spring module. This is not working any more as I read org.springframework.util.Log4jConfigurer is not supported anymore. If supported, can I get working example in Mule 4.3.0?
<spring:bean id="log4jInitialization"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<spring:property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
<spring:property name="targetMethod" value="initLogging" />
<spring:property name="arguments">
<spring:list>
<spring:value>classpath:log4j/${log4j.properties.location}</spring:value>
</spring:list>
</spring:property>
</spring:bean>
- log4j.configurationFile: Can't use this property as all APIs should have their own config.
I'm exhausted and not finding a way to load external log4j2.xml file dynamically.
Please suggest.