HighTechTalks DotNet Forums  

Re: System.Diagnostics.Trace.WriteLine

Dotnet Framework (Performance) microsoft.public.dotnet.framework.performance


Discuss Re: System.Diagnostics.Trace.WriteLine in the Dotnet Framework (Performance) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Henning Krause [MVP - Exchange]
 
Posts: n/a

Default Re: System.Diagnostics.Trace.WriteLine - 02-22-2007 , 05:13 PM






Hello,

Quote:
I guess this uses the win32 api 'OutputDebugString' is this true?
actually, it's more complicated.

The Trace class uses TraceListeners to which it delegates the messages. By
default, the DefaultTraceListener is added, which writes to the Win32
OutputDebugString function.

But you can add other (Like textfiles via TextWriterTraceListener) or create
eventlog entries (EventLogTraceListener).

I personally use the TraceSources nowadays, because you can use them as
"categories" which can be enabled and disabled via app.config and you can
have more than one in your application.

When I write console applications, I don't use Console.Out anymore, but add
a TextWriterTraceListener(Console.Out) to the Listener collection...

Now, the costs depend on the number of listeners you have and the verbosity
configured via the app.config file. You'll really have to measure it...

Best regards,
Henning Krause



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.