Debugging transformations

Several mechanisms are available for debugging transformations, such as generating debug logs or viewing the contents of the transformation context when you run a transformation. Your role as a transformation author or a transformation user determines which mechanisms you can use.

Generating debugging information for transformations

If you run a transformation and it does not generate the output that you expect, you can specify that the transformation generate a log file. A log file provides information about the source elements, the target elements, and the rules that the transformation applies to transform the source elements. If the transformation transforms many elements, you might experience decreased performance while the transformation generates the log file; therefore, you should only generate a log file for debugging purposes.

About this task

To generate a log file for a transformation:

Procedure

  1. In the navigation view, right-click a transformation configuration file; then click Open.
  2. On the Main page, click Generate a debug log.
  3. Click File > Save.

Results

The next time that you run the transformation, the log file is generated as an XML file in the folder that you specify in the transformation preferences. If you do not specify a location for the log files, the transformation generates the log file in the .metadata folder in your workspace.
Tip: To set preferences for transformations, click Window > Preferences; then expand Modeling and click Transformations.

Viewing the values of the transformation context when you debug transformations

As a transformation author, when you debug a transformation, you can view the logical structure of the transformation context. You can use this feature to navigate the hierarchical structure of the transformation context, and view the values from the transformation context and the transformation descriptor.

Before you begin

In the Java code for a transformation, you must set a breakpoint in a method that has a parameter or field that is of type com.ibm.xtools.transform.core.ITransformContext.

You must create the following items:
  • A transformation configuration for the transformation that you debug
  • An Eclipse launch configuration that starts a runtime workbench in debug mode
  • In the runtime workbench, a project that contains a model that the transformation transforms, and a target container in which the transformation generates output

About this task

To view the values of a transformation context:

Procedure

  1. Open a runtime workbench in debug mode.
  2. In the runtime workbench, apply the transformation configuration for the transformation that contains the breakpoints in the Java code. When the transformation reaches the breakpoint, the Variables view opens.
  3. In the Variables view, click the variable name that represents the transformation context.
  4. On the toolbar in the Variables view, click the Show Logical Structure icon (
    On the toolbar in the Variables view, the Show Logical Structure icon is the second icon from the left.
    ).

Results

The logical structure consists of a list of all the properties in the transformation context. The properties are sorted alphabetically by name.
Note: Some information, such as links to Eclipse documentation or to developer guides, is available only from the help topics that are installed with the product.

Feedback