public class DebugTagger extends AbstractDocumentTagger
A utility tagger to help with troubleshooting of document importing. Place this tagger anywhere in your handler configuration to print to the log stream the metadata fields or content so far when this handler gets invoked. This handler does not impact the data being imported at all (it only reads it).
The default behavior logs all metadata fields using the DEBUG log level. You can optionally set which fields to log and whether to also log the document content or not, as well as specifying a different log level.
Be careful: Logging the content when you deal with very large content can result in memory exceptions.
Can be used both as a pre-parse or post-parse handler.
<tagger class="com.norconex.importer.handler.tagger.impl.DebugTagger" logFields="(CSV list of fields to log)" logContent="(false|true)" logLevel="(FATAL|ERROR|WARN|INFO|DEBUG|TRACE)" > <restrictTo caseSensitive="[false|true]" field="(name of header/metadata field name to match)"> (regular expression of value to match) </restrictTo> <!-- multiple "restrictTo" tags allowed (only one needs to match) --> </tagger>
The following logs the value of any "title" and "author" document metadata fields.
<tagger class="com.norconex.importer.handler.tagger.impl.DebugTagger" logFields="title,author" logLevel="INFO" />
Constructor and Description |
---|
DebugTagger() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String[] |
getLogFields() |
String |
getLogLevel() |
int |
hashCode() |
boolean |
isLogContent() |
protected void |
loadHandlerFromXML(org.apache.commons.configuration.XMLConfiguration xml)
Loads configuration settings specific to the implementing class.
|
protected void |
saveHandlerToXML(EnhancedXMLStreamWriter writer)
Saves configuration settings specific to the implementing class.
|
void |
setLogContent(boolean logContent) |
void |
setLogFields(String... logFields) |
void |
setLogLevel(String logLevel) |
void |
tagApplicableDocument(String reference,
InputStream document,
ImporterMetadata metadata,
boolean parsed) |
String |
toString() |
tagDocument
addRestriction, addRestriction, addRestrictions, clearRestrictions, detectCharsetIfBlank, getRestrictions, isApplicable, loadFromXML, removeRestriction, removeRestriction, saveToXML
public void tagApplicableDocument(String reference, InputStream document, ImporterMetadata metadata, boolean parsed) throws ImporterHandlerException
tagApplicableDocument
in class AbstractDocumentTagger
ImporterHandlerException
public String[] getLogFields()
public void setLogFields(String... logFields)
public boolean isLogContent()
public void setLogContent(boolean logContent)
public String getLogLevel()
public void setLogLevel(String logLevel)
protected void loadHandlerFromXML(org.apache.commons.configuration.XMLConfiguration xml) throws IOException
AbstractImporterHandler
loadHandlerFromXML
in class AbstractImporterHandler
xml
- xml configurationIOException
- could not load from XMLprotected void saveHandlerToXML(EnhancedXMLStreamWriter writer) throws XMLStreamException
AbstractImporterHandler
saveHandlerToXML
in class AbstractImporterHandler
writer
- the xml writerXMLStreamException
- could not save to XMLpublic String toString()
toString
in class AbstractImporterHandler
public boolean equals(Object other)
equals
in class AbstractImporterHandler
public int hashCode()
hashCode
in class AbstractImporterHandler
Copyright © 2009–2021 Norconex Inc.. All rights reserved.