Interactive pdb prompt with zato server --fg does not work anymore in Zato 3


#1

Hi,

For debugging purposes it is very convenient to be able to start the zato server in the foreground (–fg) and use pdb statements inside the python code of services. For zato 2.0 this used to work, for Zato 3, this stopped working. Stdout shows a traceback, but no pdb prompt.

I tried redirecting stderr to stdout, but that did not work. Has something been changed in the way ‘–fg’ works?

Regards, Jan


#2

Hi @jjmurre,

I did not realize myself that it was possible to run pdb inside Zato services - this is really convenient, I agree.

The change was unintentional and I reverted it a moment ago - this will work once more after you install the latest updates.

For the benefit of other users - would it be possible for you to provide step-by-step instructions on how to debug services with pdb? Thanks.


#3

Hi @dsuch,

Great that you found the reason and made a fix already!

So, to have interactive pdb debugging in services, do the following.

In a Zato instance (eg. created with quickstart), start the web-admin and load-balancer in the regular way (zato start <dir-of-service>).
Start a zato server in the foreground: zato start server1 --fg
In the service that needs debugging add the pdb statement (usually: import pdb; pdb.set_trace())
Add a REST channel for this service
Trigger the service by curl-ing the REST channel
Now in the terminal where zato is running in the foreground, the interactive pdb prompt appears, and you have all the pdb niceties available.

Regards, Jan