Class DebugTagger

  • All Implemented Interfaces:
    IXMLConfigurable, IImporterHandler, IDocumentTagger

    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.

    XML configuration usage:

    
    <handler
        class="com.norconex.importer.handler.tagger.impl.DebugTagger"
        logFields="(CSV list of fields to log)"
        logContent="[false|true]"
        logLevel="[ERROR|WARN|INFO|DEBUG|TRACE]"
        prefix="(optional log prefix to further help you locate it)">
      <!-- multiple "restrictTo" tags allowed (only one needs to match) -->
      <restrictTo>
        <fieldMatcher>(field-matching expression)</fieldMatcher>
        <valueMatcher>(value-matching expression)</valueMatcher>
      </restrictTo>
    </handler>

    XML usage example:

    
    <handler
        class="DebugTagger"
        logFields="title,author"
        logLevel="INFO"/>

    The above logs the value of any "title" and "author" document metadata fields.

    Since:
    2.0.0
    Author:
    Pascal Essiembre