I have a Java EE 5 web app I\'m deploying to WebSphere 7 as an EAR file.
I want my log4j configuration to be external to the EAR file so I can tweak log content when
I find a solution to assign to each EAR or WAR an external log4j.xml configuration file:
I used this way to assign a specific external log4j configuration file to each WAR in an an EAR. Here you can find the original solution.
The log4j.configuration
property is a Java Virtual Machine system property. You can load this property by adding it to the end of your application server's list of generic JVM arguments. This is done in the WebSphere Console by navigating through the following:
Servers > Application servers > [app server name] > Process definition > Java Virtual Machine
Under Generic JVM arguments, add the following:
-Dlog4j.configuration=file:C:/log4j.properties
Click Apply
at the bottom of this page, and save your changes. This will require a restart of the application server to take effect.
You can also use shared library for an application and put your log4j.xml there.