Could someone help me with what should be a very simple issue?
I am using the latest version of ignition in trial mode. I have watched the two training videos on scripting. The person giving the sessions did not show an example of a gateway script. I can not get the scripting to work. There must be something different about the gateway scripting because all I am trying to do is print “hello” to the console. I setup a 5 second timed script with one line of code: print “hello”. This doesn’t work.
It works with the event handlers on buttons and in the script playground.
There must be something I am missing. Something like, a) Gateway scripts are different. b) Some module is not running that controls the feature. c) You have to reboot the computer every time you add anything to the gateway scripts. d) Gateway scripts are different and can’t communicate with the built in debug console.
Could someone explain how to do something very simple so that I can explore the gateway scripting feature? This shouldn’t be this difficult.
The output of gateway scripts don’t show up in your designers console because they aren’t running in your designer; right now you can find their output in the gateway’s logs. Sorry about the confusion.
Could you give me an example of a one or two line script that will write something to the gateway log?
Am I correct to assume that the log to look at is under the Ignition/Configure Tab in the section System / Console? I can see a log entry registered “Restarting Gateway Scripts” when I save and update a project. However, I can’t get a timed gateway script to print anything into this log.
There must be some different rules for writing script for gateway scripts.
The output of
will show up in the gateway wrapper log will show up in installdir/logs/wrapper.log
Thankyou. It does show up in that file log.
I couldn’t find this in the manual. The manual leads you to believe that Gateway and Client scripts work the same except for the fact that Gateway scripts are always running and Client scripts are dependent on the client.
However, I see in the forum that there is additional complexity to working with Gateway scripts. There are issues with permissions, drive mapping and the fact that they run outside of the environment that the other scripts do.
Now that I have a feedback method, I can use the file log to tell me what is going on inside these scripts.
Hopefully, this will help the next person who has problems with gateway scripts. I did spends hours searching the forum, 2 hours watching the script videos and looked up and down the printed documentation to finally have someone here help me print “hello”.
There is a a way to log from the gateway to the console instead of the wrapper log. You will need the following code
#Import Apache log4j
from org.apache.log4j import LogManager
#Create the logger with the name you want
logger = LogManager.getLogger("Test")
#Log the message
There are various severities for logging. They are
debug,error,fatal,info,trace and warn.
You can call the logger whatever you want by changing “Test” to whatever you want.
Replace “Message” with whatever you want.
Thanks for that idea. I will try it.
We are looking at ignition as a way to replace a large web application that was under development. Unfortunately, some very large and sophisticated programs were constructed in php to interact with MySQL. These programs ran on the server at the top of the hour and some every 5 minutes. I am having a hard time transitioning from php to python. My brain is rebelling against the python syntax.
I am thinking of having the gateway scripts hand off processing to some php command line scripts.
Thanks again for your help.
Why not get into Java and create some modules?
@Kyle - it sounds like he’s trying to lighten his programming load not expand it.
@Rich - good point. The documentation should be more thorough with Gateway scripting.
Both are strong points. Personally, I’d recommend calling your php items to begin with, then as time allows (if you’re like me, that may be several months or a couple of years ), you can test and migrate your php scripts to Jython or Java to streamline your processes.
This made me laugh. Not that it’s a bad idea (it’s not - creating modules is awesome and powerful), but the way you made it sound so casual.
I had that same reaction. It’s about like taking up walking for leisure.
This made me laugh. Not that it’s a bad idea (it’s not - creating modules is awesome and powerful), but the way you made it sound so casual.[/quote]
3 posts were split to a new topic: Timer Script Problem