how to set log4j.configuration system variable in WebSphere 7?
ear, log4j, websphere
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.
Problem
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 needed without needing to rebuild and redeploy the EAR file. My understanding is I can specify the location of my log4j.properties file by setting a "system variable" called log4j.configuration. (ex. log4j.configuration=c:/log4j.properties) My question is, how do I set this system variable in the WebSphere 7 admin console? Browsing around I see there is `Environment > WebSphere Variables`, but that doesn't look right because that would be setting a variable for the entire server. I'm guessing I want to set a system variable just for my application EAR file. Any help or suggestions is greatly appreciated! Rob