Try this one change:
String log4jFile = "log4j.xml";
The web application class loader looks in WEB-INF/classes automatically so you don't have to specify that.
String log4jFile = "/WEB-INF/classes/log4j.xml";
Change this to:
String log4jFile = "WEB-INF/classes/log4j.xml";
Note that there is no '/' before the WEB-INF. Try it out and see if it works.
Alternately, you can try:
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("WEB-INF/classes/log4j.xml");
Do I need to change other settings to use my own log4j.xml?
See if this helps:
I changed it to "log4j.xml" and it still cannot find it with java.util.zip.ZipException as it cannot find path.
Think I need to step back and look at my set-up to get my head round this.
The first answer was the correct one:
log4j.xml no need for WEB-INF/classes path
The other stuff was my own fault while playing around and nothing to do with problem. It now works just fine.