zoukankan      html  css  js  c++  java
  • .NET中的跟踪与调试(Trace&Debug)

    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>
  • 相关阅读:
    在你想要放弃的那一刻,想想为什么当初坚持走到了这里
    将来的你一定会感谢现在奋斗的自己
    学习改变命运,拼搏成就未来
    springmvc的DispatcherServlet源码——doDispatch方法解析
    SpringMVC02 AbstractController And MultiActionController
    SpringMVC简介01
    NIO
    数据库的锁机制
    Spring和MyBatis环境整合
    事务的隔离级别和mysql事务隔离级别修改
  • 原文地址:https://www.cnblogs.com/icewindq/p/2394294.html
Copyright © 2011-2022 走看看