Testing and Debugging Applications with Application Analytics
Once the application has been processed by Dotfuscator, telemetry is ready to be tested. When the instrumented application is started and stopped, or when an annotated feature is used, the appropriate messages should be sent to the hosted service. There are several ways to verify that the correct messages are sent at the correct times. This section discusses client-side and server-side verification techniques.
Configuring Message Tracing
The developer can obtain a client-side trace of outgoing messages by setting up message tracing in the application and examining the output as shown here in an example App.config file:
<configuration>
<system.diagnostics>
<trace autoflush="true" indentsize="0">
<listeners>
<remove name="Default"/>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\myListener.log" />
</listeners>
</trace>
<switches>
<add name="traceSwitch" value="4" />
</switches>
</system.diagnostics>
</configuration>
The <listeners>
element in the config file is where the developer can add and remove any or all listeners.
The preceding example removes the default Trace Listener, which is DefaultTraceListener
(the output window in Visual Studio), and adds the TextWriterTraceListener
, which writes traces messages to c:\myListener.log
.
TraceSwitch
This class provides support for multiple levels instead of the simple on/off control offered by the BooleanSwitch class. TraceSwitch class works with the following tracing levels:
Tracing Level | Configuration Value | Description |
---|---|---|
Off | 0 | Outputs no messages to Trace Listeners |
Error | 1 | Outputs only error messages to Trace Listeners |
Warning | 2 | Outputs error and warning messages to Trace Listeners |
Info | 3 | Outputs informational, warning and error messages to Trace Listeners |
Verbose | 4 | Outputs all messages to Trace Listeners |
The name of the trace switch used in the message sending runtime is traceSwitch
and the name of the config file trace switch name must be exactly the same for the tracing to work.
Watching Messages
HTTP traffic-logging tools such as Fiddler (available for download at http://www.fiddlertool.com) allow the developer to watch messages on the wire, thereby providing another way to obtain the message ID.
Note: It is easier to observe message traffic if SSL is turned off in the
SetupAttribute
.