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?
Comments
To log all child subroutine calls in Caché (or InterSystems ObjectScript), you can use debugging and logging methods effectively. Here are several strategies:
Using the
BREAKCommand for Debugging: You can use theBREAKcommand 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].
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].Using Line-by-Line Monitoring Tools: Tools like
codemonitor.MonLBLcan 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].Using
LOG^%ETN: The built-in methodLOG^%ETNallows capturing the runtime execution snapshot, including call stack and active local variables. Combined withDO ^%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: