.NET中的跟踪与调试(Trace&Debug)
2012-05-22 20:54
239 查看
http://www.cnblogs.com/goody9807/archive/2009/03/06/1404691.html
http://msdn.microsoft.com/zh-cn/library/b0ectfxd(v=vs.80).aspx
1.如何启用跟踪
如下为启用WCF的跟踪信息
http://msdn.microsoft.com/zh-cn/library/ee517292.aspx
<configuration>
<system.serviceModel>
<diagnostics>
<messageLogging maxMessagesToLog="30000" logEntireMessage="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logMessagesAtTransportLevel="true"> </messageLogging>
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<sources>
<!-- This section turns on digest logging, note that for this to work correctly, you need to add the following to machine.config: <system.serviceModel> <machineSettings enableLoggingKnownPii="true" /> </system.serviceModel> Search for 'DigestTrace' in the trace viewer to view the digest logs. -->
<source name="System.IdentityModel" switchValue="Verbose" logKnownPii="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<!-- Log all messages in the 'Messages' tab of SvcTraceViewer. -->
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml" />
</listeners>
</source>
<!-- ActivityTracing and propogateActivity are used to flesh out the 'Activities' tab in SvcTraceViewer to aid debugging. -->
<source name="System.ServiceModel" switchValue="Error, ActivityTracing" propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<!-- This records Microsoft.IdentityModel generated traces, including exceptions thrown from the framework. -->
<source name="Microsoft.IdentityModel" switchValue="Warning">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="trace.e2e" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
</configuration>
以下为事务的跟踪信息
<system.diagnostics>
<sources>
<source name="System.Transactions" switchValue="Information">
<listeners>
<add name="tx" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "tx.log" />
</listeners>
</source>
</sources>
</system.diagnostics>
http://msdn.microsoft.com/zh-cn/library/b0ectfxd(v=vs.80).aspx
1.如何启用跟踪
如下为启用WCF的跟踪信息
http://msdn.microsoft.com/zh-cn/library/ee517292.aspx
<configuration>
<system.serviceModel>
<diagnostics>
<messageLogging maxMessagesToLog="30000" logEntireMessage="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logMessagesAtTransportLevel="true"> </messageLogging>
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<sources>
<!-- This section turns on digest logging, note that for this to work correctly, you need to add the following to machine.config: <system.serviceModel> <machineSettings enableLoggingKnownPii="true" /> </system.serviceModel> Search for 'DigestTrace' in the trace viewer to view the digest logs. -->
<source name="System.IdentityModel" switchValue="Verbose" logKnownPii="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<!-- Log all messages in the 'Messages' tab of SvcTraceViewer. -->
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml" />
</listeners>
</source>
<!-- ActivityTracing and propogateActivity are used to flesh out the 'Activities' tab in SvcTraceViewer to aid debugging. -->
<source name="System.ServiceModel" switchValue="Error, ActivityTracing" propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<!-- This records Microsoft.IdentityModel generated traces, including exceptions thrown from the framework. -->
<source name="Microsoft.IdentityModel" switchValue="Warning">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="trace.e2e" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
</configuration>
以下为事务的跟踪信息
<system.diagnostics>
<sources>
<source name="System.Transactions" switchValue="Information">
<listeners>
<add name="tx" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "tx.log" />
</listeners>
</source>
</sources>
</system.diagnostics>
相关文章推荐
- 使用.net中的Debug与Trace加强调试能力(ldcrm)
- 【笔记】使用.net中的Debug与Trace加强调试能力(SamWang)
- 使用.net中的Debug与Trace加强调试能力(SamWang)
- 调试 函数TRACE("debug information");
- C#中Release和debug模式下调试跟踪程序的原则和方法(一)
- Sharepoint学习笔记---Debug&TroubleShooting--使用ULS Log跟踪Solution错误信息
- 我的调试跟踪函数_TRACE
- 如何使用sqlnet net trace 跟踪或调试oracle连接故障
- C#跟踪和调试程序-Debug类使用
- Android.DebugTools.Traceview & dmtracedump
- XE7 & IOS开发之开发账号(1):开发证书、AppID、设备、开发授权profile的申请使用,附Debug真机调试演示(XCode所有版本通用,有图有真相)
- Sharepoint学习笔记—Debug&TroubleShooting--引入Windbg进行诊断和调试
- 一起谈.NET技术,编写T4模板无法避免的两个话题:"Assembly Locking"&"Debug"
- XE8 & IOS开发之免费证书真机调试:开发证书、AppID、开发授权profile的申请,附Debug真机调试演示(XCode7 Beta版或以上版本适用,有图有真相)
- Eclipse中跟踪调试Android源代码&&Android中的菜单显示风格
- C#中Release和debug模式下调试跟踪程序的原则和方法(转)
- debugview trace 调试
- Description &&debugDescription && runtime(debug模式下调试model)
- 在.net中调用时出现“拒绝了对对象 'sp_sdidebug'(数据库 'master',所有者 'dbo')的 EXECUTE 权限”的错误的解决办法。
- .net知识和学习方法系列(十三)Debug和Trace