-
Move your code to a project library script, and move all imports outside the
def, along with the creation of theloggerobject (so it is persistent). -
In the first line inside the
def, invoke the logger. -
Ideally, nest all the rest of the code in a double-except
try:construct, so you can log both java and jython errors. Something like this: