Tracing a system using a monitor in Scala

Good morning,

I was trying to figure out, whether there is any form of method which could be used to trace a system in Scala.

In Erlang/Elixir, there is a method named erlang:trace/3, is there any method in Scala which is similar to this type of method please ?

Thanks a lot and good day :slight_smile:

With Scala, you have all the tooling of the JVM landscape available which you can use. (for other targets like JS / NativeCode it goes in a similar direction - just use the tools that the given environment provides).

For example, you can use JDB to set breakpoints in your function and let it stop or print out something without stopping. You might want to use a graphical debugger probably.

Then, there is byteman which enables you to programmatically inject code at any point in your code.

\edit: just noticed the section on byteman’s website:

What would I use Byteman for

The simplest use of Byteman is to inject print statements that trace what your application is doing, identifying control flow through your code and displaying the values of static or instance data.

Also, see Tracing function calls for a similar topic.

1 Like

Thanks a lot for your help. :slight_smile:

Thanks a lot and good day :slight_smile: