You can use the Forge log and JVM Logger class to help debug your Java manipulators.

Use the following features to assist you in debugging Java manipulators:

  1. Import the JVM java.util.logging.Logger class, so that you can use its severe, warning, info, config, fine, finer and finest methods in your Java manipulator code to print log messages to the Forge log file.

    Here is the relevant code from the sample that enables logging:

    //import the logging API that comes with JVM.
    import java.util.logging.Logger; 
    ...
    //Define the logger
    Logger log = Logger.getLogger(this.getClass().getName());

    The Logger class has several methods which can be used to log messages of different severity levels. An example of one of these from the sample is the line:

    //Print a message using the log to your console, letting you know that forge has entered the TextCleaner javamanipulator
    log.info("Inside the TextCleaner adapter");
  2. View the Forge log to locate the command that was used to call a specific JVM running your Java manipulator.

    In general, any messages that are printed using the JVM Logger class are automatically picked up by the Forge logging system and output into the Forge log file.

    The name of the log file is Edf.Pipeline.RecordPipeline.JavaManipulator.<JM_NAME>.log. It is located in the Forge working directory. In the log file name, JM_NAME is the name of your Java manipulator.

In addition to the Java manipulator logging, for cases in which logging does not catch all relevant information, you can insert additional components to your pipeline, or create an additional pipeline.

For example, you can insert an output record adapter in the pipeline, after the Java manipulator, to write the records to a file that you can examine.

Or, you can create an additional simple pipeline. This pipeline can write the records emitted by the Java manipulator that you are debugging into an XML file. The pipeline will contain two items: the Java manipulator that you are testing, and an XML output record manipulator that writes all records produced by the test Java manipulator to an XML output file.


Copyright © Legal Notices