So I see my testing message in the Help->Diagnostics->LogViewer, but I expect to also see it in the web interface Status-> Logs, where I have Scripting.ScriptManager.Project[TestLogger] set to Trace in Log Configuration.
I forget how this works exactly, but should I also be seeing a logger named test?
I have a Vision Client that runs some extrememly convoluted shared gateway script. I need to start untangling it, and I thought logging some debug level messages to capture certain values after certain user actions would be extremely useful.
Is there no way to get a message logged to the gateway? I can’t burdon the user with taking over their workstation to look at logger messages.
You say the user is running some convoluted gateway script - is it running it on the gateway via a message handler (or gateway tag change)? If so - those logs would in fact appear in the logs on your gateway webpage.
If you need the logged to the gateway, have the client send a message to a gateway message handler to run whatever you need on the gateway, and then whatever is logged in that context will be on your gateway logs.
You can go the reverse way as well, so when the gateway script finishes, you can send some result code to the client by making a Client Message Handler in a similar fashion. To do this, I’d suggest making system.util.getClientId - Ignition User Manual 8.0 - Ignition Documentation as part of your payload so that when you are done inside your gateway script, you know exactly how to target which specific client will get the result message.
Cool. So just to wrap this up and put a bow on for the next sorry sod …
In my SharedProject Gateway Event Scripts, I added a logMessageHandler:
This message handler will be called each time a message of this
type is received.
payload: A dictionary that holds the objects passed to this
message handler. Retrieve them with a subscript, e.g.
myObject = payload['argumentName']
logger = system.util.getLogger(payload['logger'])
level = payload['level'].lower()
message = payload['message']
if level == 'info':
elif level == 'trace':
elif level == 'debug':
elif level == 'warn':
elif level == 'error':
elif level == 'fatal':
logger.warn('Unknown level in logMessageHandler')