473,327 Members | 1,997 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,327 software developers and data experts.

Trace.WriteLine() exceedingly slow


I wrote a simple test program, console, that does one thing: log
DateTime.Now to a trace file.

I thought it would be lickety-split, but it's taking more than 10
minutes to write 1 million lines.

I looked at the trace and it's doing about 20 lines per second.

That's very slow.

I use Tracing a lot in my applications, and now I'm thinking its a big
overhead.
Jan 18 '06 #1
1 1966
John Bailo wrote:

I wrote a simple test program, console, that does one thing: log
DateTime.Now to a trace file.

I thought it would be lickety-split, but it's taking more than 10
minutes to write 1 million lines.

I looked at the trace and it's doing about 20 lines per second.

That's very slow.

I use Tracing a lot in my applications, and now I'm thinking its a big
overhead.


You have many alternatives ... This are the first two that came to my mind.

One) is instead of writing each line store it in a StringBuilder (e.g.)
and when you have a reasonable amount of lines write it to the file
(This probably is faster than physically write line by line in the file)

Two) (My favorite) Use Enterprise Library Logging application block. It
is a framework specially designed for logging that can write to many
devices (file, sql server, event log ... )

Regards,
David Hernández Díez
MCDBA MCSD vs6 6 .NET
DCE5 .Net1.1 & DCE2 .NET 2.0

Jan 18 '06 #2

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

Similar topics

2
by: Ken | last post by:
I would like to start using EventLogTraceListener, and am running into a couple of significant limitations: 1) I have found that there is no way to write EventLog entries with different...
4
by: Rukmal Fernando | last post by:
Hi, I've been looking for a good Trace message monitoring tool to monitor trace messages (through System.Diagnostics.Trace.WriteLine() etc). I need it to collect traces from non-EXE code (esp....
5
by: martin | last post by:
Hi, The trace class seems to me to be very usefull however there are a few features of it that have to confused. I am using visual studio 2003. the IDE will not let me write ...
0
by: Taylor H. Maxwell | last post by:
I am trying to build a generic system for tracking unhandled errors which will place such errors into a log file and the event log. The code is listed below. When I try to run this code below, I...
3
by: Schorschi | last post by:
Ok, can someone point out to me why the following code does not work? In compiles, no errors, but MemoryStream never seems to receive any data? Dim theMemory As MemoryStream, _ theListener As...
2
by: news.microsoft.com | last post by:
Hi all. If I wanted to write something so that, when an exception was thrown, and the stack unwound, the stack trace was captured with the values of the parameters (instead of just the parameter...
1
by: samueltilden | last post by:
I am writing one particular web app in ASP.NET 2.0 in debug mode. Even when I step through the code, the IDE skips over every occurrence of System.Diagnostics.Trace.WriteLine(), but honors...
2
by: Bob S | last post by:
I am using Debug.WriteLine and Trace.WriteLine to output messages from a dll. This dll is used in an application. No matter whether i run the program in release mode or debug mode and whether i...
1
by: =?Utf-8?B?V0o=?= | last post by:
I have enabled the /clr options in some legacy MFC projects (because I needed to use the .NET features). The TRACE macro are running VERY slow comparing the the old versions (that have no /clr...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.