Debugging a spawned process

Hello,

I have create a program, Prog1, that spawns a second program Prog2 with spawnl() command. After Prog2 is started successfully it sends a message back to Prog1 to say that it’s done. Then I end Prog1.

The problem is, after Prog1 has ended, I still want to be able to see debugging statements to the terminal made by Prog2. How can I accomplish this?

thanx.