| Debugging event handlers that use the iHub API |
A report that uses the iHub API returns the expected results only when it is run on iHub. When the report is run in Actuate BIRT Designer, the report cannot access the iHub to retrieve the server information, and the report typically returns null values. Therefore, you cannot debug the iHub API calls in the same way you debug other event handlers in Actuate BIRT Designer.
To debug iHub API calls, use the appendToJobStatus( ) method to write a debugging message for each event handler. For example, if you write a JavaScript event handler for the beforeFactory event, add the following line of debugging code:
reportContext.getAppContext().get("ServerContext").appendToJobStatus("Debugging: beforeFactory called.\n");
In a Java event handler, write:
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.appendToJobStatus("Debugging: beforeFactory called.\n");
The appendToJobStatus( ) method writes a specified string message in the status section of a job-completion notice. After running the report on iHub, you can view these messages in either iHub Management Console or iHub Information Console.
In Management Console, choose Jobs—Completed, then choose the job’s details. The job’s Status page displays the debug messages in the Status section, as shown in
Figure 21‑3.
Figure 21‑3 Debug message in the job status page in Management Console
In Information Console, choose My Jobs—Completed, then choose Details next to the job whose status you want to review. The debug messages appear in the Status section in the job details page, as shown in
Figure 21‑4.
Figure 21‑4 Debug message in the status section in the job detail page in Information Console