You can implement ILogger interface from com.groupdocs.redaction.options package. This interface requires to implement three methods. Once implemented, you can use it to track error log records:
publicclassCustomLoggerimplementsILogger{privateArrayList<String>_errors=newArrayList<String>();privateArrayList<String>_traces=newArrayList<String>();privateArrayList<String>_warnings=newArrayList<String>();publicbooleanhasErrors(){return_errors.size()>0;}publicvoiderror(Stringmessage){_errors.add(message);}publicvoidtrace(Stringmessage){_traces.add(message);}publicvoidwarning(Stringmessage){_warnings.add(message);}}CustomLoggerlogger=newCustomLogger();finalRedactorredactor=newRedactor("sample.docx",newLoadOptions(),newRedactorSettings(logger));try{// Here we can use document instance to perform redactions
redactor.apply(newDeleteAnnotationRedaction());if(!logger.hasErrors()){redactor.save();}}finally{redactor.close();}
sample.docx is the sample file used in this example. Click here to download it.