Question
· Nov 3

Is there a way to log all child sub routine calls in cache?

For example, I'm creating a customer at front end interface. I want to list down all the routines and child sub routines that are called at backend in mumps/cache. What's the best way to do it?

Product version: Caché 2017.1
Discussion (1)2
Log in or sign up to continue

To log all child subroutine calls in Caché (or InterSystems ObjectScript), you can use debugging and logging methods effectively. Here are several strategies:

  1. Using the BREAK Command for Debugging:
    You can use the BREAK command during routine execution to set up breakpoints. This helps interrupt execution at specific points and allows stepping into subroutine calls, therefore providing visibility into what routines and child subroutines are being executed. For example:

    • BREAK "L+" enables breaking at all routine levels including subroutines. This will allow you to monitor line-by-line execution and transitions between routines [1].
  2. Temporary Globals for Logging:
    You can use temporary globals to store a log of the operations. For instance:

    KILL ^Log
    SET ^Log($INCREMENT(^Log)) = "Executing XYZ routine"
    

    Later, you can inspect the log using ZWRITE ^Log [2].

  3. Using Line-by-Line Monitoring Tools:
    Tools like codemonitor.MonLBL can monitor ObjectScript execution line-by-line and provide detailed insights, including the executed lines of code, the number of times they were executed, and global references. This output can be exported to a CSV file for further analysis [3].

  4. Using LOG^%ETN:
    The built-in method LOG^%ETN allows capturing the runtime execution snapshot, including call stack and active local variables. Combined with DO ^%ERN, you can further analyze the stored logs. This approach is particularly suitable for debugging backend logic [2].

Using a combination of one or more of these mechanisms should help you effectively log all calls to routines and subroutines in your Cache/Mumps backend systems. [1][2][3]

Sources: