Debugging Database Errors

Your application’s Web.config file contains a varity of logging and tracing options.  These options are commented out in your application’s Web.config file and can be easily enabled.  If you turn on logging, the logged information is contained in your system’s Event Viewer.  If you turn on tracing, the information is displayed below the page within your browser.

.NET applications support a variety of run-time application tracing and page-level tracing.

Tracing Overview:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcontracefunctionality.asp

Enabling App-level Tracing:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconenablingapplication-leveltracing.asp

Enabling Page-level Tracing:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondisplayingtracemessagesonpage.asp

Both logging and tracing may also be turned off globally.  Make sure you turn on the global logging and/or tracing in addition to the individual type of logging and tracing.

Logging

LogCommitExceptions:  Set to “all” to log all database transaction commit exceptions. The default is to log only exceptions which are unlikely to be caused by normal user interaction.  Please make sure global logging is turned on to see these exceptions.

LogDatabaseExceptions: Set to "all" to log all database exceptions. The default is to log only exceptions which are unlikely to be caused by normal user interaction.  Please make sure global logging is turned on to see these exceptions.

LogDatabaseCommands: Set to "true" to load all database commands being executed by the application in the Event Viewer.  Please make sure global logging is turned on to see these commands.

Global Logging:  Set LogEvents value="true" to display all logging to the system the event log.  The default value is "true" if this entry does not exist in your application’s Web.config file.

Tracing

TraceDataAccessMethods: Set to "true" to display all the data access methods being called.  This trace is displayed on the web page itself and is quite detailed.  Please make sure global tracing is turned on to see this tracing.

TraceDatabaseCommands: Set to "true" to display all database commands being executed.  This trace is displayed on the web page itself. Please make sure global tracing is turned on to see this tracing.

TraceTransactionCache: Set to "true" to display the state of the transaction cache.  This trace is displayed on the web page itself. Please make sure global tracing is turned on to see this tracing.

Global Tracing: Application-level tracing enables trace log output for every page within an application. Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the trace information will be displayed at the bottom of each page.  Otherwise, you can view the application trace log by browsing the "trace.axd" page from your web application root.

See Also

Debugging Applications