We finally got our log working consistently (although not as sophisticated as
3132's Logger, it's a foundation in which stuff can be added on). It looks like the race condition problems listed above were the culprit. The key is not to completely overwhelm it with added lines in the main loop.
We have wrapped it in a class if anyone's interested:
http://gist.github.com/296373