Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
During design time, you can use the debugger to find and fix problems in your code. Once you deploy your application, what can you do to diagnose any problems you might encounter?
Fortunately, the tracing features built into LightSwitch can help you. You can use this to instrument and monitor the applications you have deployed. Microsoft.LightSwitch.Trace is the class that you would use to perform trace-related activities. This class contains three methods you can use to write out trace messages:
- TraceError,
- TraceInformation,
- TraceWarning.
The messages you create using these methods are sent to objects called listeners. During debug, a DefaultTraceListener displays any trace messages you have written into the Visual Studio output window. Other listeners that you can use include the EventLogTraceListener and TextWriterTraceListener. These listeners are used to write trace messages into the Windows event log or a text file. The trace.axd handler allows you to view trace messages through a web page, and we’ll explain how to view this later on.