Specifying a different config file for Log4J
Generally, adding a log4j.properties file to the classpath is all that needed to bootstrap your Log4J runtime. In certain cases though you might want to override this behaviour.
I needed to do this recently and it took me a while to find out how to do it in the Log4J docs, so I though I’d make a note of how to do it here.
To specify a file that Log4J will use instead of the default, pass its details as a system property when starting the JVM as follows:
java -Dlog4j.configuration=resources/log4j_dev.properties
The above example will load the log4j_dev.properties file from within the resources folder in the classpath. A file URL may also be specified:
java -Dlog4j.configuration=file:/resources/log4j_dev.properties
This will cause the log4j_dev.properties file to be loaded from the resources folder at the root of the file system.

April 8, 2011 - 4:55 am
The question is, how do you then confirm that it picked up the file you wanted it to pick up, and not the default one? There must be some way to have it tell you which file it is using for configuring itself, but I have yet to find it.
April 8, 2011 - 8:08 am
Surely it’s apparent from the difference in the log output?
July 26, 2011 - 12:37 pm
You could use, org.apache.log4j.PropertyConfigurator.configure(”resources/log4j_dev.properties”);