Writing to the Trace Log from Custom Code
Applies to: SharePoint Foundation 2010
In Microsoft SharePoint Foundation 2010 there are two ways that developers can write to the Trace Logs: by using the object model, and by using SPMonitoredScope.
The object model methods for writing to the Trace Logs were present in Windows SharePoint Services 3.0, however, in SharePoint Foundation 2010 improvements have been made to simplify their use.
For more information, see Using the Trace Logging API
SPMonitoredScope is used to wrap potential failure points in the code, and have messages written to the logs as well as displayed in the Developer Dashboard.
For more information about using SPMonitoredScope, see Using SPMonitoredScope