LogManager.resetConfiguration();
if(!isInWarFile()) { System.out.println("Logging already initialized. Skipping..."); return; }
    public void init() throws ServletException {    	LogManager.resetConfiguration();    	        // Get data from web.xml        String file = getInitParameter("log4j-init-file");                // Get path where eXist is running        String existDir =  getServletContext().getRealPath("/");                // Define location of logfiles        File logsdir = new File(existDir, "WEB-INF/logs" );        logsdir.mkdirs();        System.out.println("eXist logs dir="+ logsdir.getAbsolutePath());        System.setProperty("logger.dir", logsdir.getAbsolutePath() );                        // Get log4j configuration file        File configFile = new File(existDir,file);        System.out.println("eXist log4j configuration="+configFile.getAbsolutePath());                // Configure log4j        DOMConfigurator.configure(configFile.getAbsolutePath());    }