I want to write a Logger/ Bug-Tracker with XML output for my current project. I'm sorry if it should be a duplicate, but the proposals were not useful and I did not found a good google solution too.
1: My first question is about exception safety.
If i use a XmlDocument the loggs are stored in memory till i call save. That means i could lose everything in case of an exception.
If I use a XmlWriter it's not stored in memory (afaik) but I have to close the writer and all elements / nodes which may be a lack in case of an exception too. Can I close and re-open the writer (with the pointer at the end of the document) ?
What's the best solution for an exception-safe XML creation ? (I only need a hint)
2: My second question is about memory usage.
Because it's a tracing tool the output can be very huge. Therefore I can't use XmlDocument. In my opinion the XmlWriter would be the best solution for this. Am i right with this ?
3: My last [minor] question is about time consumption.
Is it a good or bad idea to use a XML file for tracing? How much does it slow down my program ?
I hope you can help me.
EDIT: why do I want to use XML ? later on, my app will run in an "unknown" environment therefore it is neccessary that I can send the log over internet to a server and I have to validate the file (XMLSchema). After this is done I want to convert it to a better readable (and nice formatted) HTML file.
As you can see, this is a much better visualization than XML (this still need some fine tuning but it's functional)
EDIT 2: current state I have made some memory usage measurements. The Logger (currently based on XmlDocument :( ) need ~600mb for 5.000.000 entries. Not the best result but not the worst too.
Best regards Alex
Because this question did not contains a good answer, i have to answer it myself. I've dicided to use a ringbuffer with 10k entries for my log (this seems to be a good number in live use) and i've tried to build a thread and exception safe logbuf (i hope it works).
best regards and thx for all answers
Alex