LogEntry lets you write your own text message to the log when a Turnkey or server-side action runs. Use it to record checkpoints and values while investigating MDrivenServer or Turnkey action behavior.
Use LogEntry in an action
LogEntry is an OCL operation. Call it on the ViewModel object when you want to add a message to the log.
selfVM.LogEntry('hello I am logging here')When this expression runs in a Turnkey action or an MDrivenServer server-side action, the text hello I am logging here is written to the log files under /logs.
Add a diagnostic message
- Open the action that you want to investigate in the Actions Editor.
- Add a LogEntry expression at the point where you need confirmation that the action has reached that step.
- Replace the example text with a message that identifies the operation being performed.
- Run the Turnkey action or MDrivenServer server-side action.
- Inspect the log files under
/logsfor the message.
For example, add a message before a section of action logic:
selfVM.LogEntry('Starting order validation')Use messages that describe the action stage, such as Starting order validation, rather than generic messages such as here. This makes multiple log entries easier to interpret.
Where LogEntry works
| Execution context | Result |
|---|---|
| MDrivenServer server-side action | Writes the supplied text to the log files under /logs.
|
| Turnkey action | Writes the supplied text to the log files under /logs.
|
Syntax
selfVM.LogEntry('message text')| Part | Meaning |
|---|---|
selfVM
|
The ViewModel object on which the operation is called. |
LogEntry
|
The OCL operation that writes a log entry. |
'message text'
|
The string to write to the log. |
For the operator definition and the original example, see Documentation:OCLOperators LogEntry.
