I have an Igntion project that will not log any information to the Gateway. I am using logger = system.util.getLogger('TheLoggerName'). I have also checked the logging levels in my project and the gateway and they are set to the same level. Is there anyone that can help me figure out what the issue is?
Where are you running the script that calls the function with a logger? Have you confirmed that this script is actually getting called?
If you are testing in the designer then the logging will be in the designer.
If you are running in vision then it will be logging to the local client logger.
Perspective will log to gateway, regardless of designer or actual session.
I have a logger in the projects startup event. But I cannot see its statement in Diagnostics or in the Gateway. I place the logging statement in the beggining so I believe call to the logger is being made. This is a Perspective project by the way.
Try copying the same code to a button so you know for certain it is executing your code. Try executing it from designer so it will yell at you if you have a code error.
Just eliminating possibilities, does your script actually call to log something? Ie, logger.warn('Oops something broke')
Yes, it does. Just a simple "hello world" using the INFO filter
Perspective sessions tend to be a bit sticky, how are you testing the project startup script?
Try launching a session in an incognito tab of your browser and see if you see your logger message. I don't believe project startup will fire from designer.
I was able to add a button. Inside of the onclick event, I added logging. But I am not seeing that in the designer, in the gateway or in the console.
Show your actual code.
This is what I have in the projects startup gateway event:
logger = system.util.getLogger("myLoggerTest")
logger.warn("inside of startup")
system.util.getLogger("myLoggerTest2").info("This is a log message")
I have that code at the very top of the Startup Event.
That will log only to the gateway. Look carefully at your gateway.
When do you want this to log, on new Perspective session startup or on gateway startup?
This makes it sound like you put it in the gateway startup event instead of the session startup event.
Session startup event - fired on startup of perspective session
Gateway Startup event - fired on startup of your gateway
I would like to log in different placess but it doesn't matter this point. If I can get any logging from the project, I will be happy.
This inside of a button script should work.
For project library loggers, the following generalized format should work:
import blah
logger = system.util.getLogger('project.library.' + __name__)
def myFunction(paramA):
""" """
for x in xrange(10):
pass
logger.info("Done!")
return
Does your code editor for button actions or event definitions show any red squiggles for syntax errors in the right margins?
No, the code editor does not show any red squiggles.
Are you saving your project before testing gateway scope code?
Are you sure the gateway you are checking for logs is the same gateway your designer is connected to?