Adding debug print messages to Groovy extension scripts
When adding debug messages to Groovy extension scripts in WFM, errors can occur instead of the expected debug output if the
DebugPrint messages are not coded correctly. Common error messages include:
Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.ObjectNo such property: DebugPrint for class: groovy.lang.Binding
To avoid these errors, ensure sure that:
- The DebugPrint class is imported at the start of the script.
- All debug messages qualify the
debugprintmethod with the class name. - Debugging is enabled for the script by selecting the Enable Debugging checkbox on the script editing page. Debugging stays active for one hour and automatically turns off after that. DebugPrint statements only work while debugging is turned on.
See KB3615058 for more information.
Note: These following combinations result in errors when you run the script:
- If the debug messages are coded as simply
debugprint("message")' and theDebugPrintclass is not imported first, this error is displayed:Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (script17490753495371967955061 debugprint line 1 message) - If the debug messages are coded as
DebugPrint.debugprint("message")and theDebugPrintclass is not imported first, this error is displayed:No such property: DebugPrint for class: groovy.lang.Binding - If the
DebugPrintclass is imported and the debug messages are coded as simplydebugprint("message"), this error is displayed:Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (script1749075549508278284712 debugprint line 3 message)
This behavior applies to any Groovy extension script type that uses DebugPrint for logging.