HMI.Trace
- Last UpdatedOct 29, 2026
- 2 minute read
Logs a text message. This is typically done to debug the project.
|
Group |
Execution |
|---|---|
|
Log Message |
Synchronous |
Syntax
HMI.Trace(strOutputMessage)
strOutputMessage
A string to be logged as a message. The name of the tag. Specify a string enclosed in quotes (double quotes or single quotes), or a Python variable containing the name of the tag (do not use quotes). If this parameter is not enclosed in quotes, it will be treated as a Python variable, potentially causing an exception if this variable does not exist. See the examples for more information.
Note: Tag values can be accessed using HMI.GetTagValue. The argument can only be a string; the examples show the use of str() and F-String.
Note: Tag Properties are accessible using the syntax HMI.GetTagValue('Tag->TagProperty'). Some tag properties may need to be cast to a string (using str()), even in an F-String.
Return value
This function returns no value.
Notes
HMI.Trace accesses the built-in function Trace.
Enable runtime Python logging to show HMI.Trace messages:
-
In the AVEVA Edge Studio development environment, and the SCADA or Embedded HMI runtimes, the HMI.Trace messages appear in the Studio Output window or the runtime LogWin tool.
-
In the IoT View runtime, the HMI.Trace messages appear in the IoT View runtime log.
Examples
Display static text that reports a specific event:
HMI.Trace("Beginning step 5.")
Display the text value of Python variable pyStrVar:
HMI.Trace(pyStrVar)
Display the date by referencing the appropriate system tag:
HMI.Trace(str(HMI.GetTagValue("Date")))
Concatenate static text and tag references to form a complex message:
HMI.Trace(f"The current time is: {HMI.GetTagValue('time')}.")
HMI.Trace("The current time is: " + str(HMI.GetTagValue('time')) + ".")
HMI.Trace(f"The value of myTag is: {HMI.GetTagValue('myTag')}")
HMI.Trace(f"The quality of myTag is: {HMI.GetTagValue('myTag->Quality')}")
HMI.Trace(f"The current datetime is: {str(HMI.GetTagValue('Second->TimeStamp'))}")