Skip to content

Commit

Permalink
Set lower log level when loading an XML resource (openhtmltopdf#4)
Browse files Browse the repository at this point in the history
We are generating PDFs which include many external SVG files using `<img
src="xyz.svg"/>`.
Following two log lines are repeated for **every** loaded SVG, which in
our case results with more than 5000 uninformative log messages per PDF:
```
2024-01-28T16:39:26.411+01:00  INFO 11121 --- [nio-8080-exec-7] com.openhtmltopdf.load                   : SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
2024-01-28T16:39:26.411+01:00  INFO 11121 --- [nio-8080-exec-7] com.openhtmltopdf.load                   : Loaded document in ~0ms
```

I believe log level can be lowered from INFO to FINEST since these
messages can be quite invasive. LMKWYT :eyes:
  • Loading branch information
icrnjak authored Jan 29, 2024
1 parent 6d27156 commit 980520d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static final XMLReader newXMLReader() {
"property, which is set to: " + System.getProperty("javax.xml.parsers.SAXParserFactory"));
}

XRLog.log(Level.INFO, LogMessageId.LogMessageId1Param.LOAD_SAX_XMLREADER_IN_USE, xmlReader.getClass().getName());
XRLog.log(Level.FINEST, LogMessageId.LogMessageId1Param.LOAD_SAX_XMLREADER_IN_USE, xmlReader.getClass().getName());

return xmlReader;
}
Expand Down Expand Up @@ -274,7 +274,7 @@ private XMLResource createXMLResource(XMLResource target) {

target.setElapsedLoadTime(end - st);

XRLog.log(Level.INFO, LogMessageId.LogMessageId1Param.LOAD_LOADED_DOCUMENT_TIME, target.getElapsedLoadTime());
XRLog.log(Level.FINEST, LogMessageId.LogMessageId1Param.LOAD_LOADED_DOCUMENT_TIME, target.getElapsedLoadTime());

target.setDocument((Document) output.getNode());
return target;
Expand Down

0 comments on commit 980520d

Please sign in to comment.