I am trying to run a jar with the log4j.xml file on the file system outside the jar like so:
java -jar MyJarName.jar -cp=/opt/companyName/pathToJar/ log4j.co
For log4j2, use configurationFile option:
java -Dlog4j.configurationFile=/path/to/log4j2.xml -jar ...
http://logging.apache.org/log4j/2.0/manual/configuration.html