Logging messages

You can log user-specified messages when a state behavior is executed and use the eventDisplay block or State Chart > Breakpoints to browse the logged messages. When logging is active on a state, a red exclamation point appears next to the state name in the Header.

Logging actions

When logging is active on a transition, a red ball appears on the arrowhead for the transition.

Logging does not break state chart execution.

Logging messages can be used not only for state chart debugging, but also as part of state chart interface for reporting events of interest.

To log state messages

When you simulate the diagram, messages are stored in a temporary buffer. The contents of the buffer can be displayed in an eventDisplay block.

1.    Right-click the Header portion of the state.

2.    Click the Activity Manager tab.

3.    Activate Log Message and enter the message in the corresponding box.

4.    Click OK, or press ENTER.

To attach a message to a transition

When you simulate the diagram, the messages are stored in a temporary buffer. The contents of the buffer can be displayed in an eventDisplay block.

1.    Right-click the transition.

2.    Select Properties to access the Transition Properties dialog.

3.    Activate Attach Log Messages and enter a message in the corresponding box.

4.    Click OK, or press ENTER.

To display logged messages with the eventDisplay block

The eventDisplay block displays the stored messages. You can insert an eventDisplay block at any time and if there are stored messages, the eventDisplay block automatically lists them.

Each time the diagram is executed, the buffer overwrites the existing messages with new messages from the simulation.

      In the continuous time area of the diagram, insert an eventDisplay block into the work area.

To display logged messages with Breakpoints

Breakpoints automatically display all logged messages stored in a temporary buffer. Logged messages are prefaced with red exclamation points.

Each time the diagram is executed, the buffer overwrites the existing messages with new messages from the simulation.

      Choose State Charts > Breakpoints.

To jump to a logged message with Breakpoints

      Choose State Charts > Breakpoints, then select the breakpoint and click Jump.

To delete a logged message

      Choose State Charts > Breakpoints, then select the logged message to be deleted and click Remove.

To delete a logged message – Alternate Method

1.    Right-click the Header portion of the state.

2.    Click the Activity Manager tab.

3.    Under Selected Actions, select the action that has a logged message.

4.    De-activate Log Message.

5.    Click OK, or press ENTER.

Example

In this example, the state Init has message logging enabled. When the simulation runs, the eventDisplay block logs the message.

state object error logging