The best way to get scoped log4j configuration for you deployments is to use a Repository Selector
Using a Repository Selector for your own scoped log4j configuration
In some rare cases using classloader scoping is an alternative. However, you should avoid this option if at all possible because it will significantly increase the complexity of your deployments and potentially cause unexpected side effects.
Using classloader scoping for your own log4j.xml file
Using classloader scoping for your own log4j.properties file