I'm not sure I understand the major differences between ETW using System.Diagnostics.Tracing, and using System.Diagnostics.Trace. I understand that with both of them I can dump events onto some output stream, and that I can use various listeners to intercept this data - including custom listeners.
But except the fact that ETW's infrastructure is embdded into Windows and I can use WPR and PerfView out of the box, I don't see a difference.
When would I choose one over the other?
System.Diagnostics.Tracing
is much more complete than Trace
:
On the other hand, System.Diagnostic.Trace
is a straightforward logger: you can only log strings, and you cannot apply any kind of filtering (it is either enabled for all messages, or disabled for all). But it has the advantage of being supported per default by the Visual Studio debugger (so when you attach to the process, you directly see trace events in the output window).
I'd add that having an ETW listener provided out of the box is a nice perk of System.Diagnostics.Tracing
, but technically nothing would prevent you from writing your own ETW listener for Trace
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments