In recent discussions, answers, comments IO redirection (with the famous code) was quite often seen
as the ultimate solution. It is definitely strong stuff and you can not only log your output but also do
key-grabbing in input.
But I think for simple logging it's quite a significant overhead.
If you just need to get some text or dump your variables or objects then SPOOL should be sufficient for your needs.