There are a few different things you can do.
1. Use what is there. That is, in the Arduino IDE source code for the function main,
It sets up to have:
everything that went to stdout goes to the file /tmp/log.txt
everything that went to stderr goes to the file /tmp/log_err.txt
I look at the file contents using some form of terminal connection (debug terminal or ssh connection). Note: the /tmp directory is in RAM so you reboot and it is gone. When I am debugging some Arduino stuff, I have sketch to reboot, which copies the two files to my home directory.
2. Modify Main to do something else.
3. Have your stuff output to something else. Like JPMontero_Intel mentioned, you can output to main console terminal, by using the Serial2 object within Arduino IDE