Try using something like log4net or NLog both of which are free and easy to use, rather than rolling your own. I use log4net in a console application and it writes clear and concise log files with pipe-delimited fields; so easy to parse and view, if required. Very quikc and easy to set up and integrate into your code.
No real way to know what is wrong with your code if you don't provide samples/exceptions.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum
yup - while I have some issues with log4net (I use a custom startup so I can dynamically define where the log file goes based on where the app exe is located, rather than a fixed path/location for log files), I'd recommend it to anyone starting out using/needing logging
I have tried the Nlog tool. It worked well with one project, and when I tried to add it to another project, it was a complete mess. I was not able to add the config file specific to this second project.
I read that you need to install the tool, not having any pojects opened, just only the VS opened. I did that as well, but it was not straight forward.