Question
· Feb 12

How to get the Job id for a BS API Rest for debug?

Hi all,

As you know, it is very complicated to debug a Business Service Rest API because the object is created when the applications receive a request, so we cannot have the JobId that we can use to debug.

https://docs.intersystems.com/iris20211/csp/docbook/DocBook.UI.Page.cls?...

So, I'm trying to get the JobId when the class is being created, write a trace in OnInit() method and write the JobId in a log info

Method OnInit() As %Status
{
	$$$LOGINFO("JobId: "_$JOB)
	hang 20 break
	Quit ..OnInit()
}

Unfortunately, it seems to ignore this method because it doesn't show any traces or do the 20 seconds stop.

Then, my second attempt was to write it directly in the method.

/// MyMethod POST
ClassMethod MyMethodPost() As %Status
{
	$$$LOGINFO("JobId: "_$JOB)
	hang 20 break
    ..... 
    Quit $$$OK
}

and it works, but I need 20 seconds to open Event Log, Get the JobId, attach the Id in Studio or VS Code and debug the code...

Maybe Superman can do it, with his super speed.

My cuestion is....

is it possible to have a hang instrucction by more time, but I can break the hang when I want?

Is there a common method (such as OnInit()) that is called when the application receives a request? I don't want to put this piece of code in all the methods of my API service.

Thanks in advance.

Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2021.1.3 (Build 389U) Wed Feb 15 2023 14:50:06 EST
Discussion (3)2
Log in or sign up to continue