
Ignition Perspective Button Logging
Ignition Perspective Button Logging
Design and review Ignition 8.1 Perspective button logging workflows with an offline assistant focused on operator auditability, HMI troubleshooting, and practical target-side validation. This listing helps with Button onActionPerformed wrappers, Project Library helper patterns, audit records, logger messages, SQL or Named Query action logs, blocked-command evidence, and compact verification checklists.
Tested with Ignition 8.1.53.
Built from 10+ years of manufacturing and industrial automation experience across food packaging, planter-part manufacturing, and Tier 1 automotive environments, including practical Ignition use in production-facing work.
What It Helps With
- Review Perspective Button event scripts, exported view JSON, screenshots, component notes, Project Library snippets, Named Query resources, and pasted target evidence.
- Keep button scripts thin while moving durable logging behavior into a reusable Project Library helper.
- Capture operator, session, page, stable button key, target path, previous value, requested value, outcome, write quality, audit status, and correlation ID.
- Add explicit logging for UI-only actions such as popups, navigation, custom prop changes, blocked commands, and operator acknowledgements.
- Produce a bounded validation plan the buyer can run on their own Gateway without live access from the assistant.
Example Prompt
Use ignition-perspective-button-logging to review a button logging design.
Review this Ignition 8.1 Perspective button logging design for an operator command button. The exported view has a Button at <Perspective/View/Path/ButtonName> with custom.auditKey = "pump_start_command". Its onActionPerformed script writes True to <Tag/Path/PumpStartCmd> and should log operator, session, page, target tag, previous value, requested value, outcome, write quality, audit record status, and a correlation ID.
Suggest a compact Project Library helper pattern, a thin event wrapper, and an offline verification checklist. Assume I will provide screenshots, bounded log excerpts, audit query results, and SQL readback rows after testing on my Gateway.
Example Output
Recommended Pattern
Use a thin Perspective event wrapper and put the durable behavior in a Project Library helper. The wrapper should pass only explicit context and should not hide command logic inside the component event script.
Perspective Button Event Wrapper
# Perspective Button events.component.onActionPerformed
result = project.audit.buttonLogging.log_command_button(
projectName="<ProjectName>",
sessionId=self.session.props.id,
pageId=self.page.props.pageId,
pagePath=self.page.props.path,
actor=self.session.props.auth.user.userName,
buttonKey=self.custom.auditKey,
targetPath="<Tag/Path/PumpStartCmd>",
requestedValue=True
)
self.view.custom.lastButtonLogResult = result
Project Library Helper Shape
# Project Library: project.audit.buttonLogging
import java
import java.util.UUID
def log_command_button(projectName, sessionId, pageId, pagePath, actor,
buttonKey, targetPath, requestedValue):
correlationId = java.util.UUID.randomUUID().toString()
logger = system.util.getLogger("audit.buttonLogging")
previous = system.tag.readBlocking([targetPath])[0]
previousValue = previous.value
outcome = "UNKNOWN"
writeQuality = "NOT_ATTEMPTED"
auditStatus = "NOT_ATTEMPTED"
try:
logger.info("intent buttonKey=%s actor=%s correlationId=%s" %
(buttonKey, actor, correlationId))
system.util.audit(
action="PerspectiveButtonPress",
actionTarget=buttonKey,
actionValue=str(requestedValue),
originatingSystem=[
"page", pagePath,
"pageId", pageId,
"sessionId", sessionId,
"correlationId", correlationId
]
)
auditStatus = "RECORDED"
qualities = system.tag.writeBlocking([targetPath], [requestedValue])
writeQuality = str(qualities[0])
outcome = "WRITE_OK" if qualities[0].isGood() else "WRITE_BAD"
except java.lang.Throwable, exc:
outcome = "FAILED"
logger.error("button logging failed correlationId=%s" % correlationId, exc)
params = {
"project_name": projectName,
"session_id": sessionId,
"page_id": pageId,
"page_path": pagePath,
"actor": actor,
"button_key": buttonKey,
"target_path": targetPath,
"previous_value": str(previousValue),
"new_value": str(requestedValue),
"outcome": outcome,
"write_quality": writeQuality,
"audit_status": auditStatus,
"correlation_id": correlationId
}
system.db.runNamedQuery(projectName, "<NamedQuery/Path/InsertActionLog>", params)
logger.info("result buttonKey=%s outcome=%s writeQuality=%s correlationId=%s" %
(buttonKey, outcome, writeQuality, correlationId))
return params
Verification Checklist
- Confirm the project audit settings that are expected to capture built-in auditable actions.
- Click the button once from a known user/session.
- Capture the visible page path, user, button state, and requested value.
- Collect bounded wrapper logger lines filtered by the returned correlation ID.
- Query the custom action table for the same correlation ID and confirm button key, actor, page path, target path, previous value, new value, outcome, and write quality.
- Query the audit log using target-side Ignition tools and compare the button key or correlation ID.
- For gated or disabled variants, verify the helper logs a blocked outcome and that the target tag did not change.
Offline Capafy Edition
This Capafy edition works from user-provided project exports, snippets, screenshots, table/Named Query context, log excerpts, audit readbacks, and described Perspective behavior. It does not require live Gateway access, does not call external APIs, and does not modify a running Ignition project.
Live Gateway reads, writes, Perspective deployment, production project changes, database changes, or real-time Gateway execution are outside this download edition and require separate authorization, backups, and target-side validation.
Suggested Tags
Ignition 8.1, Perspective, Button Logging, Audit Logs, SCADA
Support
For support, contact [email protected].