使用Trace和TraceSource之间的区别

问题描述:

任何人都知道System.Diagnostic.TraceSystem.Diagnostic.TraceSource类之间的区别?使用Trace和TraceSource之间的区别

我一直在使用跟踪我的大部分项目,而我只是在前几天发现了约TraceSource。他们似乎提供了类似的API,是比其他更好的?

我认为TraceSource是较新的版本(因为.NET 2)和Trace是旧版本,更多信息,请访问:

Clarification on TraceSource/Trace

+3

From http:// msdn。 microsoft.com/en-us/library/ms228989.aspx:“TraceSource旨在运行作为增强型跟踪系统,可用于替代较早的Trace和Debug跟踪类的静态方法。熟悉的Trace和Debug类仍然存在,但推荐的做法是使用TraceSource类进行跟踪。“ – 2010-05-11 15:53:45

TraceSource可增强对您的跟踪粒度:在您的配置文件中,您可以在所需的级别启用/禁用所需的跟踪源(信息,警告,错误,...) 您可以在此找到真正好的解释:http://www.codeproject.com/Articles/149251/Debugging-Tracing-and-Instrumentation-in-NET-and-A