Hi

how to create log files by c# code. Suppose we have windows XP and our application requirement is to create system_idle logfile for performance check of the system.
and at last i will check performance in the application.


Thanks in advance...

Do you just want a simple text log file, or are you talking performance counters?

If you want a log file, open a stream and write to it..

Thanks Lizr

I will take help from objects(ex: system) and counters (for ex: %idle time and %processor time) and i want to create the log at runtime....

That didnt really answer the question, but once again, if you want a simple readable text file, open a stream and write it :)

I do not want deployment log like thing.. Since, i want to get system performance details, I would like the performance logger to write the log file by applying counters. If the log file is available, i will read that information into my application. So, in this scenario i have to programmatically configure the performance logger, so that it produces a log file of the system performance. I could manually configure the logger using counters and objects but I want to do it programmatically. How can I do this?


Thanks a lot for your responses...

Ok, so the answer was you wanted to use the windows based performance counters.

Try http://msdn.microsoft.com/en-us/library/5e3s61wf(VS.71).aspx

Thank you very much LizR... It is my logoff time.. Surely this was a very great help.. i will check your hyperlink tomorrow.... Good night.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.