If you need logging, you better use logging, not home-based techniques.
See my post in response to these Questions:
This is how to make a custom logger (to log to text, to UI or whatever):
MsBuild OutPut to the TextBox on the fly in Windows Application[
^]
This is how to log to the System log, but with structure:
How to create event log under a folder[
^]
I offered a whole complete wrapper code here.
—SA