Please enable JavaScript to view this site.

Invantive Vision

Navigation: Invantive Vision > Performance

SQL Trace

Contents Previous Home Next More

To save the SQL statements in a file the following code needs to be part of app.config or web.config:

 

 <system.diagnostics>

   <sources>

     <source name="System.ServiceModel" switchValue="Error">

       <listeners>

         <add name="xmlTrace" />

       </listeners>

     </source>

     <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">

       <listeners>

         <add name="xmlTrace" />

       </listeners>

     </source>

   </sources>

   <sharedListeners>

     <add name="xmlTrace" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\temp\client_verbose.svclog" />

   </sharedListeners>

   <trace autoflush="true">

     <listeners>

       <add name="xmlDataTrace" traceOutputOptions="Callstack,DateTime,LogicalOperationStack,ProcessId,ThreadId,Timestamp" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\temp\client_data_verbose.svclog" />

     </listeners>

   </trace>

 </system.diagnostics>

 

In the specified file (in this example ‘C: \ temp \ client_verbose.svclog’), the SQL statements will be logged. This file can be read with SvcTraceViewer (can be found in the Windows SDK, but also in the Invantive tools).