Search code examples
c#.netwinformserror-reporting

Making log files and error reporting


If an error occurrs, a log file,in "pure text" format will be created to then be sent by another application, the errorReportin.exe. That's a GUI application that will read and by using BackgroundWorker sent the file contents to my e-mail.

1-question: Do I need really to use some XML or JSON etc instead of simple text file? why? will I have some kind of problem by using this? I can't think one reason for don't use simple text file. It's easy to read, maybe by reading the e-mail only I can have a idea either solve the probrem.

2-question: Is dangerous make this file readable to anyone? do I need encrypt it or something like?

Until now, I'm loging StackTrace and Message from Exception and Date. Say if you think that I'm missing some information to do log.


Solution

    1. Use whatever file format makes sense for your application. XML and JSON are useful if you're conveying information with a number of different fields, but if it's a simple message then plain text is perfectly fine. In fact many applications pass simple text messages for inter-process communication.

    2. This depends on the sensitivity of your data and whether it's exposed on the public internet. If the answer to both is yes, you should take steps to ensure the transport and/or message are protected.