protected void doConfigure(final ParseAction action, final LoggerRepository repository) {
// This line is needed here because there is logging from inside this method.
this.repository = repository;
selfInitialize(this.repository);
ExecutionContext ec = joranInterpreter.getExecutionContext();
List errorList = ec.getErrorList();
SAXParser saxParser = null;
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(false);
spf.setNamespaceAware(true);
saxParser = spf.newSAXParser();
} catch (Exception pce) {
final String errMsg = "Parser configuration error occured";
getLogger(repository).error(errMsg, pce);
ec.addError(new ErrorItem(errMsg, pce));
return;
}
JoranDocument document = new JoranDocument(errorList, repository);
try {
action.parse(saxParser, document);
} catch(IOException ie) {
final String errMsg = "I/O error occured while parsing xml file";
getLogger(repository).error(errMsg, ie);
ec.addError(new ErrorItem(errMsg, ie));
} catch (Exception ex) {
final String errMsg = "Problem parsing XML document. See previously reported errors. Abandoning all further processing.";
getLogger(repository).error(errMsg, ex);
errorList.add(
new ErrorItem(errMsg));
return;
}
ec.pushObject(repository);
String errMsg;
try {
attachListAppender(repository);
document.replay(joranInterpreter);