Debugging

At the present, a complete step by step debugger is not available. Neverthless a tracing tool exists and it can be easily used for debugging a Jolie program.

Tracing

A Jolie program can be easily traced enabling this feature in the command line with the parameter --trace. As an example, let us consider the helloworld program explained here. If you need to enable the tracer just run it using the following command line:

jolie --trace myFirstJolieService.ol

As a result, in the console, you should see the following lines:

[myFirstJolieService.ol] 1. ^ LOAD Java Service Loader joliex.io.ConsoleService
<yourpath>/myFirstJolieService.ol:52. << SR println@Console SENDING MSG_ID:1
Value: = Hello, world! : string
<yourpath>/myFirstJolieService.ol:53. << SR println@Console SENT MSG_ID:1
Value: = Hello, world! : string
‚Äč
Hello, world!
<yourpath>/myFirstJolieService.ol:54. << SR println@Console RECEIVED MSG_ID:1
Value:

it reports all the actions performed by the program. In the specific case it just reports the three actions related to the solicit-response println which are: SENDING, SENT, and RECEIVED. If it seems strange to you that printing something to the console triggers some message exchage actions, just remember that in Jolie everything is a service and also printing a message on the console requires a service. This is why we see the three actions related to the message sending.

Jolie Trace Viewer

When the Jolie program has a lot of lines of code it could be quite difficult to analyze a trace reported into the console. In this case it is possible to use a web tool which make the navigation of the traces more easy. In order to enable it, it is necessary to save the traces into a file instead of printing them in the console. In order to do this, just specify the parameter file after the term --trace as in the following example:

jolie --trace file myFirstJolieService.ol

In this case, no traces will be printed in the console, but they will be stored into a file named as <timestam>.jolie.log.json. Such a file can be navigated using a built-in tool called jolietraceviewer. Just run the following command from the same folder where you run the Jolie program: jolietraceviewer. The following statement will appear in the console: Jolie Trace Viewer is running, open your browser and set the url http://localhost:8000. Thus, just open your brower at http://localhost:8000 and navigate through the traces generated by your Jolie program.

Running the jolietraceviewer on a different port

By default jolietraceviewer runs on port 8000 but it is possible to change it by specifying a different port as an argument. In the following example we run jolietraceviewer on port 8001. jolietraceviewer 8001

Defining the tracer level

By default the tracer just traces everything both communication and computation actions. It is possible to restricts the tracing only to communication actions or computation actions. Use the parameter ---traceLevel [ALL|COMP|COMM] for specifying the level. As an example let us consider the following:

jolie --trace file --traceLevel comm myFirstJolieService.ol

It just traces only the communication actions. Use comp for tracing only the computation ones.