Hi Everyone,
I am pulling gateway logs into a table just fine, but I would like to display a bit more info. Something like the 'log properties' (the little magnifying glass that shows you the project name, device name etc. associated with the message) would be very helpful. Are the message 'log properties' stored somewhere? Can they be queried? As always, any help/info is greatly appreciated.
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.common.logging import LogQueryConfig
manager = IgnitionGateway.get().getLoggingManager()
config = LogQueryConfig.newBuilder().build()
config.setLimit(200)
results = manager.queryLogEvents(config)
rows = []
for event in results.getEvents():
properties = event.getProperties()
rows.append({
"timestamp": system.date.fromMillis(event.getTimestamp()),
"level": str(event.getLevel()),
"loggerName": str(event.getLoggerName()),
"message": str(event.getMessage()),
"properties": str(properties) if properties else ""
})
system.perspective.print("rows"+str(rows))
Use this on Perspective component any Event Action (onStartup, onActionPerformed, onClick ... etc), you can get the log properties, and other data.