Logging messages

You can log user-specified messages when a state behavior is executed and use the eventDisplay block or Breakpoints command 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 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, the messages are stored in a temporary buffer. The contents of the buffer can be displayed in an eventDisplay block.

1.    Point to the Header portion of the state and right-click.

2.    Click the Activity Manager tab.

3.    Activate the Log Message parameter and enter the message into the corresponding parameter.

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.    Point to the transition.

2.    Right-click and select Properties to access the Transition Properties dialog box.

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

4.    Click OK, or press ENTER

To display logged messages with the eventDisplay block

The eventDisplay block displays the messages stored in an Embed temporary buffer. You can insert an eventDisplay block at any time and if there are stored messages, the eventDisplay block will automatically list them.

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

1.    In the continuous time portion of the diagram, insert an eventDisplay block, located under Blocks > Signal Consumer, into the work area.

2.    If messages have already been logged, they will appear in eventDisplay window.

To display logged messages with the Breakpoints command

The Breakpoints automatically displays all logged messages stored in an Embed temporary buffer. Logged messages are prefaced with a red exclamation point.

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

      Choose State Charts > Breakpoints.

To jump to a logged message with the Breakpoints command

1.    Choose State Charts > Breakpoints.

2.    In the dialog box, select the breakpoint and click Jump.

To delete a logged message

1.    Do one of the following:

2.    Choose State Charts > Breakpoints.

3.    In the dialog box, select the logged message to be deleted and click Remove.

To delete a logged message – Alternate Method

1.    Point to the Header portion of the state and right-click.

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