Tuesday, 19 May 2020

Exception Handling in Jython | IBM Maximo

from psdi.util.logging import MXLoggerFactory
from psdi.util.logging import MXLogger


try:
       
    log = MXLoggerFactory.getLogger("maximo.application.AUTOSCRIPT")
    scriptname="<script name>"
    log.info("******Entering Autoscript : " +scriptname +"******")
       
   
    log.debug("[DEBUG] script "+scriptname+" <Message>")
   
    log.info("******Existing Autoscript : " +scriptname +"******")   

Exceptions Handling

except Exception, e:
    print >> sys.stderr, "[ERROR] script "+scriptname+" failed: ",e.message
    print >> sys.stdout, "[ERROR] script "+scriptname+" failed: ",e.message
    log.error("[ERROR] script "+scriptname+" failed: " +e.message)

No comments:

Post a Comment