Tag value changed event script only shows error in the gateway logs once

Hello all,

I have noticed that when a tag value changed event script throws an error it is only logged in the gateway logs a single time. When the script runs again and throws the same error, it doesn’t show in the logs. I find this to be frustrating because if I don’t notice the error the first time it happens it is easy to miss any subsequent script failures when looking over the logs.

To (hopefully) recreate this I created a boolean memory tag, and a integer memory tag and put the following script on the boolean tag’s value changed event:

	if not initialChange:
			
		i = system.tag.readBlocking(['[default]testInt'])[0].value
		system.tag.writeBlocking(['[default]testInt'], [i + 1])
		
		j = None
		
		j.thisDoesntExist = 1

When I run the script the first time, it increments the integer tag, then throws an AttributeError as you would expect. Then when I run the script again, it increments the integer tag, but does not throw the error again. Because the integer value was incremented I know the script ran, but it does not throw the error even though I would imagine the same exception was thrown.

The only way that I can find to get the script to throw the error again is to make a change to the script (even if it is just added a new line to the beginning of the code) and commit it before running the script again.

Does anyone know if this is intended behavior, or just a bug?

Thanks,
Chandler

It’s intended, the script is flagged with an error status and the log message is not repeated on subsequent executions.

The alternative is our support department receiving useless logs filled with repeated tag change errors that might not even be relevant to the issue they are troubleshooting…

If the logger for tags.eventscripts.dispatcher is put on DEBUG level then repeated errors will be logged as well.

1 Like

There’s usually a message with the original error saying that further occurences will be suppressed.

That makes sense. I will just turn my logger level up, since I would rather see the errors so I can go fix the problem, rather than miss it and forget for weeks.

Thanks for the speedy response!

I think DEBUG level might result in some other messages being logged as well… and it won’t persist across gateway restarts.

1 Like

You can also use a try:except: block to handle them yourself.

1 Like

Is there a way to see if a script has been flagged with an error status?

The diagnostics on that tag should indicate some kind of error.