I know what you are looking for.
In "main.cpp" just create an ofstream object in this way:
using namespace std;
ofstream fout( "logfile.txt" );
Then you can put debug strings in your program simply writing
fout << "Debug string\n"; fout.flush();
This would create a different log file per each core. The log file will be automatically created in the root home directory on each core. After your program fails or complete successfully, you can see what happened logging into each core:
ssh root@rck03 less logfile.txt
and see where the program stopped.
I have used this method successfully to find a bug in the RCCE library, so I'm sure it works.