J
jb.bavoux
Hello ,
is it a good idea to use an xml file to write a log file?
If i use a file like that:
<LOGFILE>
<LINE>
<TIME>2007-11-28 10:00:00</TIME>
<LOG>something appens</LOG>
</LINE>
<LINE>
<TIME>2007-11-28 10:00:10</TIME>
<LOG>another thing appens</LOG>
</LINE>
</LOGFILE>
I want my log file to be closed each line:
open the file, log, close the file
in order to have a correct file anytime.
My problem is that each time I open the file I have to remove the end
tag, insert my line, then reappend the end tag. I find this not
'clean'.
I could remove the first level tag <LOGFILE>, but in this case is my
file still xml ?
My second problem is that if my program(computer) crash writting the
log, my file is no more xml compliant.
....
<LINE>
<TIME>2007-11-28
EOF
then all my logs in this file become unreadable !!
and next logs will be unreadable too if I continue to log in this file
<LINE>
<TIME>2007-11-28 <LINE>
<TIME>2007-11-28 10:00:10</TIME>
<LOG>another thing appens</LOG>
</LINE>
What do you think about it?
is it a good idea to use an xml file to write a log file?
If i use a file like that:
<LOGFILE>
<LINE>
<TIME>2007-11-28 10:00:00</TIME>
<LOG>something appens</LOG>
</LINE>
<LINE>
<TIME>2007-11-28 10:00:10</TIME>
<LOG>another thing appens</LOG>
</LINE>
</LOGFILE>
I want my log file to be closed each line:
open the file, log, close the file
in order to have a correct file anytime.
My problem is that each time I open the file I have to remove the end
tag, insert my line, then reappend the end tag. I find this not
'clean'.
I could remove the first level tag <LOGFILE>, but in this case is my
file still xml ?
My second problem is that if my program(computer) crash writting the
log, my file is no more xml compliant.
....
<LINE>
<TIME>2007-11-28
EOF
then all my logs in this file become unreadable !!
and next logs will be unreadable too if I continue to log in this file
<LINE>
<TIME>2007-11-28 <LINE>
<TIME>2007-11-28 10:00:10</TIME>
<LOG>another thing appens</LOG>
</LINE>
What do you think about it?