Learning how to pull Session information from Session Events Startup

My objective is to learn a bit more about what I can and can't accomplish from a page startup script.

In order to do this, I provided the following scripts for Session Events 'Startup' and 'Page Startup' respectively:

def onStartup(session):
	import java.lang.Exception
	try:
		system.perspective.print('SP')
		system.perspective.print(session.props.path)
	except java.lang.Exception, e:
		system.perspective.print(e)
		pass

	try:
		system.perspective.print('SI')
		system.perspective.print(session.props.pageId)
	except java.lang.Exception, e:
		system.perspective.print(e)
		pass
def onPageStartup(page):
	import java.lang.Exception
	try:
		system.perspective.print('PP')
		system.perspective.print(page.props.path)
	except java.lang.Exception, e:
		system.perspective.print(e)
		pass


	try:
		system.perspective.print('PI')
		system.perspective.print(page.props.pageId)
	except java.lang.Exception, e:
		system.perspective.print(e)
		pass

These seemed pretty foolproof to me: a way to display the current session ID and page that are mentioned as parameters in the session. But the only content I've been able to return when I launch the project from a new tab or browser session is

PP
/
PI
2521bafb

This seems to imply two things to me:

  1. onStartup, which I would assume would occur before onPageStartup, does not get seen by perspective.print, at all; which would imply that session scoped... stuff... wouldn't get picked up by perspective.print
  2. I'm limited to calling loggers with system.util.getLogger to see startup content.

Are these correct assumptions?

Bonus question: while I was attempting to build this script I had some syntax errors in my system.perspective.print statements (I used page.pageId instead of page.props.pageId). These syntax errors didn't throw any exceptions, they actually just caused my scripts to fail after displaying

PP

Which was frustrating to troubleshoot. Is there an alternative way I could construct exception handling to so I can more easily handle errors?