You can use LogEntry in an OCL expression to write your own diagnostic text to the log when a MDrivenServer ServerSide ViewModel action or a Turnkey action runs.
Purpose
LogEntry writes a string to the Turnkey, MDrivenServer, or debugger log. Use it to record progress, input values, and branch decisions while diagnosing ViewModel behavior.
For example, this expression records a message when the action is evaluated:
selfVM.LogEntry('hello I am logging here')
Use LogEntry in an action
- Open the action that runs in Turnkey or as a ServerSide ViewModel action.
- In the action's OCL expression, call
LogEntryonselfVM. - Pass the text that you want to appear in the log.
- Run the action.
- Review the Turnkey, MDrivenServer, or debugger log output. Server-side log files are located under
/logs.
Syntax
selfVM.LogEntry('message text')
| Part | Meaning |
|---|---|
selfVM
|
The current ViewModel context. |
LogEntry
|
The OCL operator that writes a log message. |
'message text'
|
The string to write to the log. |
Examples
Mark an action step
Use a fixed message to confirm that the action reached a specific point:
selfVM.LogEntry('Starting customer import')
Record a branch decision
Place a different entry in each branch so that the log shows which path ran:
if SomeCondition then
selfVM.LogEntry('Condition was true')
else
selfVM.LogEntry('Condition was false')
endif
When to use it
Use LogEntry when you need diagnostic output from ServerSide ViewModel work. It is the preferred way to add your own crafted messages to that output. Keep messages specific enough to identify the action step being investigated.
For the general logging overview, see Documentation:LogEntry. For finding available OCL operators in the editor, see Documentation:OCL General Operators.
