473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XML Logging Write one record

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
Apr 6 '06 #1
6 2758
I believe methods in the XMLTextWriter class should be able to do what
you want.

Apr 6 '06 #2
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.

Apr 6 '06 #3
Where can i find "BitFactory Logging", Can het write XML ?

Hans

"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.

Apr 7 '06 #4
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" <Ha**@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.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

Apr 8 '06 #6
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

"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" <Ha**@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.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


Apr 9 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: j vickroy | last post by:
Hello, I'm trying to understand the behavior of the Python 2.3 logging module (MS Windows 2k) with regard to RotatingFileHandler. The following script illustrates a puzzling problem. What is...
0
by: Marek Augustyn | last post by:
Hello, I'm getting strange exception raised using module logging. It's strange because it happens only sometimes, and it happens in different places (but always in a logging method). i.e. this...
15
by: Stefan Behnel | last post by:
Hi! I'm trying to do this in Py2.4b1: ------------------------------- import logging values = {'test':'bla'} logging.log(logging.FATAL, 'Test is %(test)s', values)...
0
by: Neil Benn | last post by:
Hello, I'm running a test and having issues with logging, if I call logging.shutdown() and then want to start the logging going again then I get a problem as if I call shutdown, I can't get the...
23
by: Rotem | last post by:
Hi, while working on something in my current project I have made several improvements to the logging package in Python, two of them are worth mentioning: 1. addition of a logging record field...
7
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
2
by: Russell Warren | last post by:
I was just setting up some logging in a make script and decided to give the built-in logging module a go, but I just found out that the base StreamHandler always puts a newline at the end of each...
6
by: Larry Bates | last post by:
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I...
4
by: Alexandru Mosoi | last post by:
why doesn't logging throw any exception when it should? how do I configure logging to throw exceptions? .... logging.fatal('asdf %d', '123') .... except: .... print 'this line is never...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.