Debugging Event Handlers
Host Integrator includes a variety of options for testing an event handler.
Debugging Event Objects
When you develop an event handler, you can use Host Integrator debugging options
to confirm that the handler is returning the results you expect. The event handler
demonstrate these options.
- Use the connection events
test to confirm that life cycle event handlers and model event handlers
you have added to your model are performing as you expect.
- Test operation events with the Execute
button on the Operation tab in the Entity window.
- Test events that include recordset and recordset field events using the
Recordset Test option available from
the Debug menu.
- Test procedures with the Procedure Test
option available from the Debug menu
- Use the Attributes Test available from
the Debug menu for any event handler that uses Write Attributes.
- If debugging on the server is required, use Host Integrator Web Builder.
You must configure
the server for debugging.
General Debugging Options
The Validator confirms that libraries associated
with event handlers are up to date.
The Event Handler Console displays
the output that event handlers send to the Java system output stream.
You can modify the following properties in properties
- Traps outputOn the Session Server, stack dumps for unhandled exceptions
are written to a file. By default, this is the <VHI>\etc\output\traps.out
- Custom output fileOn the Session Server, you can define a custom
file name property in <VHI>\etc\script.properties and dt_script.properties,
and any custom debugging information is written to those files.
See the guidelines on limiting use
of output streams.
Remote Java debugging
If the debugging port on the Java virtual machine that hosts the script
manager is enabled, you can use your Java IDE's remote debugging features
to set breakpoints, step through code, and view runtime status. The debug port
is opened by default in the Design
Tool, but must be enabled in the configuration before startup (or restart)
in the Session Server. You can
review the debugging port setting for the Design Tool on the event handler settings
Debugging tab; review
a Session Server's assigned
event handler debug port in the Administrative WebStation.
Event Handler Timeouts
Event handler timeouts can be disabled in both the Session
Server and the Design
Tool. When event handler timeouts are disabled, all timers used to calculate
timeouts (for a single session) are suspended whenever that session has fired
an event to the script manager. Once the script manager returns a response to
the Design Tool or Session Server, the suspended timers will resume.
Testing event handler timeouts
Use these steps to test event handler timeouts.
- Place a breakpoint in the event handler code activated by an event.
- Leave event handler timeouts enabled.
- Set the event handler timeout and client timeouts to a value larger than
the time expected for the event handler activity.
- Cause the event to fire and stop execution at the breakpoint.
- Use the Cancel button while the
event is in progress to force a timeout exception to be sent to the event
- Begin single-stepping through the event handler code to determine how the
event handler reacts to the timeout.
© 2007 Attachmate Corporation. All rights reserved.