Discussion
· 10 hr ago

Debugging REST API in InterSystems IRIS

Hi developers!

How do you debug implementation code in .impl classes of REST.API in InterSystems IRIS?

Especially if you don't have access to globals, so no things like: 

Set ^AAA="here we are"

not possible in this case.

Suppose I have the following signature of the REST.API method called as POST and containing JSON. :

ClassMethod submitForm(formData As %Stream.Object) As %Stream.Object
{

return formData

}

Can I debug "line by line" or "command by command"?

Can I return anything to the browser's console? Or into any IRIS expected place, which is relatively easy to check?

What are my options? 

Please, share your experience?

Discussion (7)2
Log in or sign up to continue

3 variants come to my mind

  1. writing to ErrorLog  Do LOG^%ETN()
  2.  write to Systrem message.log
     set %evgeny=$io
     open 1 use 1 write !,"Was in my REST code",! close 1
     use %evgeny
  3. If you have a terminal session  LOCK  ^%EVGENY --- And into your code, add this simple loop 
  4.  for  LOCK +^%EVGENY QUIT:$TEST   HANG 0.5
    Now your method loops, and you can attach with any external debugger. Releasing the LOCK from Terminal does the "un-freeze"