Home All Groups Group Topic Archive Search About

XML Logging Write one record

Author
6 Apr 2006 7:41 PM
Hans
Hello,

I want to put logging functionality in my application and i want to store
this information in an XML file with date, string and integer values.

How do i write just one record to the XML file.

I don't want to use a dataset and i don't wan to load the entire file into
memory.

Is this possible ?

Can someone give me a simple example?

Thanks in advanced

Hans

Author
6 Apr 2006 8:06 PM
zacks
I believe methods in the XMLTextWriter class should be able to do what
you want.
Author
6 Apr 2006 8:07 PM
zacks
Oh yeah, the process of logging has been done to death. There are all
kinds of freeware logging libraries out there. We currently use
BitFactory Logging.
Author
7 Apr 2006 9:00 AM
Hans
Where can i find "BitFactory Logging", Can het write XML ?

Hans

Show quoteHide quote
"za***@construction-imaging.com" wrote:

> Oh yeah, the process of logging has been done to death. There are all
> kinds of freeware logging libraries out there. We currently use
> BitFactory Logging.
>
>
Author
7 Apr 2006 12:24 PM
zacks
Author
8 Apr 2006 12:05 AM
Stephany Young
Sure, freeware 'loggers' are a dime a dozen, but you can bet your bottom
dollar that none of them will do exactly what you want.

Using XML, you will run into some problems and I wonder why it is that you
want to use XML.

For me, the questions that need to be answered include:

  - What do I want to record

  - Why do I want to record it

  - What use am I going to make of the information.

If the log is going to be read by yourself only (or someone who knows how to
interpret the information), and the information is in a linear timeline then
i would recommend appending the information (one line per 'event') to a
simple text file.

The problem with using XML for this is that XML lives in memory as a
complete XMLDocument that you add nodes to (as children of the root node at
the very least). As the XMLDocument grows it will take longer and longer to
flush it to disk. Appending to an XML file sequentially is problematic
because the closing tag of the root node will need to be overwritten each
time you append a node.



Show quoteHide quote
"Hans" <H***@discussions.microsoft.com> wrote in message
news:E8521B63-2A53-439D-BD2C-166B465792E8@microsoft.com...
> Hello,
>
> I want to put logging functionality in my application and i want to store
> this information in an XML file with date, string and integer values.
>
> How do i write just one record to the XML file.
>
> I don't want to use a dataset and i don't wan to load the entire file into
> memory.
>
> Is this possible ?
>
> Can someone give me a simple example?
>
> Thanks in advanced
>
> Hans
>
>
Author
9 Apr 2006 2:19 PM
Hans
Hi Stephany,

I'm developing an industrial application that's going to communicate with an
PLC.
We must log about 100 lines of information a day, and we want to make 1 new
file every week ot month.
We like to log information like errorcode,description, date, time.

The reason we like to log to an xml file is that we like to analyse this
information.

I know how to make the file, and read and write to it ( Dataset read and
write).
But i don't want read the complete file into memory for writing one record.
Is this possible ?

Thanks

Hans

Show quoteHide quote
"Stephany Young" wrote:

> Sure, freeware 'loggers' are a dime a dozen, but you can bet your bottom
> dollar that none of them will do exactly what you want.
>
> Using XML, you will run into some problems and I wonder why it is that you
> want to use XML.
>
> For me, the questions that need to be answered include:
>
>   - What do I want to record
>
>   - Why do I want to record it
>
>   - What use am I going to make of the information.
>
> If the log is going to be read by yourself only (or someone who knows how to
> interpret the information), and the information is in a linear timeline then
> i would recommend appending the information (one line per 'event') to a
> simple text file.
>
> The problem with using XML for this is that XML lives in memory as a
> complete XMLDocument that you add nodes to (as children of the root node at
> the very least). As the XMLDocument grows it will take longer and longer to
> flush it to disk. Appending to an XML file sequentially is problematic
> because the closing tag of the root node will need to be overwritten each
> time you append a node.
>
>
>
> "Hans" <H***@discussions.microsoft.com> wrote in message
> news:E8521B63-2A53-439D-BD2C-166B465792E8@microsoft.com...
> > Hello,
> >
> > I want to put logging functionality in my application and i want to store
> > this information in an XML file with date, string and integer values.
> >
> > How do i write just one record to the XML file.
> >
> > I don't want to use a dataset and i don't wan to load the entire file into
> > memory.
> >
> > Is this possible ?
> >
> > Can someone give me a simple example?
> >
> > Thanks in advanced
> >
> > Hans
> >
> >
>
>
>