This is not a log4j problem per se. It appears to be xerces errors, but maybe someone ran into it before and can help.
Prior to configuring log4j with an xml config file, I read the file myself and check log file pathnames set in some appenders. I then transform the document back into an InputStream and feed this to DOMConfigurator. The following errors are reported. Apparently, the DOCTYPE is being stripped out. I'm using jaxp and I have searched for mechanism to include the DOCTYPE, but nothing is obvious. log4j:ERROR Parsing error on line 2 and column 98 log4j:ERROR Document root element "log4j:configuration", must match DOCTYPE root "null". log4j:ERROR Parsing error on line 2 and column 98 log4j:ERROR Document is invalid: no grammar found. The config DOM dumped to the console is: <?xml version="1.0" encoding="UTF-8"?> <log4j:configuration debug="null" threshold="null" xmlns:log4j="http://jakarta.apache.org/log4j"> : : </log4j:configuration> The parsing code snippet is: Document doc = null; DocumentBuilderFactory dbFactory = null; dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); DocumentBuilder db = dbFactory.newDocumentBuilder(); db.setEntityResolver(new LogDTDResolver()); doc = db.parse(is); The console dump code snipped is: DOMSource ds = new DOMSource(dumpSrc); ByteArrayOutputStream baos = new ByteArrayOutputStream(); TransformerFactory tfactory = TransformerFactory.newInstance(); Transformer serializer = tfactory.newTransformer(); Properties oprops = new Properties(); oprops.put("method", "xml"); oprops.put("omit-xml-declaration", "no"); oprops.put("indent", "yes"); serializer.setOutputProperties(oprops); serializer.transform(ds, new StreamResult(baos)); System.out.println(baos.toString()); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
